Files
zig/test/cases/compile_errors/unreachable_in_naked_func.zig
T
Jacob Young 8159ff8b81 x86_64: implement error set and enum safety
This is all of the expected 0.14.0 progress on #21530, which can now be
postponed once this commit is merged.

This required rewriting the (un)wrap operations since the original
implementations were extremely buggy.

Also adds an easy way to retrigger Sema OPV bugs so that I don't have to
keep updating #22419 all the time.
2025-02-15 03:45:21 -05:00

31 lines
803 B
Zig

fn runtimeSafetyDefault() callconv(.Naked) void {
unreachable;
}
fn runtimeSafetyOn() callconv(.Naked) void {
@setRuntimeSafety(true);
unreachable;
}
fn runtimeSafetyOff() callconv(.Naked) void {
@setRuntimeSafety(false);
unreachable;
}
comptime {
_ = &runtimeSafetyDefault;
_ = &runtimeSafetyOn;
_ = &runtimeSafetyOff;
}
// error
// backend=stage2
// target=native
//
// :2:5: error: runtime safety check not allowed in naked function
// :2:5: note: use @setRuntimeSafety to disable runtime safety
// :2:5: note: the end of a naked function is implicitly unreachable
// :7:5: error: runtime safety check not allowed in naked function
// :7:5: note: use @setRuntimeSafety to disable runtime safety
// :7:5: note: the end of a naked function is implicitly unreachable