-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Implement immediate-abort by hooking #[rustc_panic_entrypoint] and lint for functions that look like a panic entrypoint #150497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
☔ The latest upstream changes (presumably #150386) made this pull request unmergeable. Please resolve the merge conflicts. |
| bx.abort(); | ||
| bx.unreachable(); | ||
| return MergingSucc::False; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For cg_clif you can add fx.bcx.ins().trap(TrapCode::user(1 /* unreachable */).unwrap()); at
rust/compiler/rustc_codegen_cranelift/src/base.rs
Line 1084 in d465f99
rust/compiler/rustc_codegen_cranelift/src/base.rs
Line 1055 in d465f99
| let msg_ptr = crate::constant::pointer_for_anonymous_str(fx, msg_str); |
Should be possible to check |
There are a handful of functions, mostly in
coreandalloc, which have a mess of attributes on them which try to ensure that they compile down to justintrinsics::abort()whencfg(panic = "immediate-abort"), and otherwise are outlined.The goal of this change is to officially recognize this pattern: These are entry points to the panic runtime.
The "immediate aborting" of
panic = "immediate-abort"is now implemented by replacing calls to entrypoint functions with calls to theintrinsics::abort, instead of manually ensuring that these functions are all#[inline]with bodies that only callintrinsics::abort, or that optimize to such a body.TODO:
#[rustc_panic_entrypoint]imply#[cold] #[inline(never)] #[track_caller]? Is that even easy to implement?