0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/lib/std/debug
Matthew Lugg 5f74e4f3f8 Sema: make loading uninstantiable types a runtime safety panic
For generic code, it is far more useful to consider this equivalent to
`unreachable`. Meanwhile, it is difficult to accidentally write concrete
code which performs this operation, so very little is actually lost from
not having a compile error.

If we accept that this operation does not trigger a compile error, then
it already has the potential to invoke Illegal Behavior today, because
uninstantiable types have an unspecified size in memory, so the
dereference always potentially exceeds the pointer's provenance. (That
said, this only means it is *possible* for the operation to invoke IB,
so the langspec should nonetheless explicitly specify that dereferencing
a pointer to an uninstantiable type is itself Illegal Behavior.)

Storing uninstantiable types into memory does not require any specific
language rules, because that operation can never be reached anyway due
to it requiring an operand (the RHS of `a = b`) whose type is the store
type, which is (by definition) impossible for uninstantiable types.

Resolves: https://codeberg.org/ziglang/zig/issues/36247
History 2026-08-04 22:29:50 +02:00
..
Dwarf zig fmt 2026-07-17 23:30:26 +02:00
SelfInfo std.debug.SelfInfo.Elf: clear unwind cache when rebuilding module list 2026-07-20 13:56:43 +02:00
Coverage.zig zig fmt 2026-07-17 23:30:26 +02:00
cpu_context.zig cbe: update for compiler_rt abi changes 2026-07-27 14:35:12 -04:00
Dwarf.zig debug.Dwarf: FORM_ref_addr is host address sized in DWARFv2 2026-08-02 12:03:06 +02:00
ElfFile.zig zig fmt 2026-07-17 23:30:26 +02:00
Info.zig std.debug.Info: make Mach-O source location resolution more resilient 2026-03-20 17:19:28 +01:00
MachOFile.zig debug.MachOFile: handle truncated dwarf section names 2026-08-02 14:18:11 +02:00
no_panic.zig Sema: make loading uninstantiable types a runtime safety panic 2026-08-04 22:29:50 +02:00
Pdb.zig zig fmt 2026-07-17 23:30:26 +02:00
simple_panic.zig Sema: make loading uninstantiable types a runtime safety panic 2026-08-04 22:29:50 +02:00