-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
acceptedThis proposal is planned.This proposal is planned.breakingImplementing this issue could cause existing code to no longer compile or have different behavior.Implementing this issue could cause existing code to no longer compile or have different behavior.enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Milestone
Description
There should only be 1 panic handler function and it should be possible to override it by only providing one function. Furthermore, it should be the entry point from the language; there should be no other dependencies on the std lib such as formatted printing.
It should look something like this:
pub const PanicCause = union(enum) {
unreach,
unwrap_null,
cast_to_null,
incorrect_alignment,
out_of_bounds: struct {
index: usize,
len: usize,
},
sentinel_mismatch_usize: usize,
sentinel_mismatch_isize: isize,
sentinel_mismatch_other,
/// This one comes from a call to `@panic`.
application_msg: []const u8,
// ...
};
pub fn panic(cause: PanicCause, error_return_trace: ?*StackTrace, ret_addr: ?usize) noreturn {
// ...
}This provides complete flexibility to the application overriding the default handler, while keeping it to a single function to be overridden.
emidoots and 16hournapsemidoots
Metadata
Metadata
Assignees
Labels
acceptedThis proposal is planned.This proposal is planned.breakingImplementing this issue could cause existing code to no longer compile or have different behavior.Implementing this issue could cause existing code to no longer compile or have different behavior.enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.