mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
Fix issue where root.os.panic could return
This commit is contained in:
parent
b2e970d157
commit
2f1abd919a
@ -671,7 +671,12 @@ pub const PanicFn = fn ([]const u8, ?*StackTrace) noreturn;
|
||||
|
||||
/// This function is used by the Zig language code generation and
|
||||
/// therefore must be kept in sync with the compiler implementation.
|
||||
pub const panic: PanicFn = if (@hasDecl(root, "panic")) root.panic else default_panic;
|
||||
pub const panic: PanicFn = if (@hasDecl(root, "panic"))
|
||||
root.panic
|
||||
else if (@hasDecl(root, "os") and @hasDecl(root.os, "panic"))
|
||||
root.os.panic
|
||||
else
|
||||
default_panic;
|
||||
|
||||
/// This function is used by the Zig language code generation and
|
||||
/// therefore must be kept in sync with the compiler implementation.
|
||||
@ -684,10 +689,6 @@ pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace) noreturn
|
||||
@breakpoint();
|
||||
}
|
||||
}
|
||||
if (@hasDecl(root, "os") and @hasDecl(root.os, "panic")) {
|
||||
root.os.panic(msg, error_return_trace);
|
||||
unreachable;
|
||||
}
|
||||
switch (os.tag) {
|
||||
.freestanding => {
|
||||
while (true) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user