Dwarf: handle noreturn union fields in more places

A little clunky -- maybe the frontend should give an answer here -- but
this patch makes sense with the surrounding logic just to fix the crash.

Resolves: #24265
This commit is contained in:
mlugg 2025-08-13 12:21:06 +01:00 committed by Matthew Lugg
parent e304a478c0
commit 3736aac778

View file

@ -3241,7 +3241,7 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo
const field_type: Type = .fromInterned(loaded_union.field_types.get(ip)[field_index]);
try wip_nav.refType(field_type);
try diw.writeUleb128(loaded_union.fieldAlign(ip, field_index).toByteUnits() orelse
field_type.abiAlignment(zcu).toByteUnits().?);
if (field_type.isNoReturn(zcu)) 1 else field_type.abiAlignment(zcu).toByteUnits().?);
}
try diw.writeUleb128(@intFromEnum(AbbrevCode.null));
break :tag .done;
@ -4599,7 +4599,7 @@ fn updateContainerTypeWriterError(
const field_type: Type = .fromInterned(loaded_union.field_types.get(ip)[field_index]);
try wip_nav.refType(field_type);
try diw.writeUleb128(loaded_union.fieldAlign(ip, field_index).toByteUnits() orelse
field_type.abiAlignment(zcu).toByteUnits().?);
if (field_type.isNoReturn(zcu)) 1 else field_type.abiAlignment(zcu).toByteUnits().?);
}
if (loaded_union.field_types.len > 0) try diw.writeUleb128(@intFromEnum(AbbrevCode.null));
},