-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Make rustc implicitly use panic=abort for the panic_abort crate #140254
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: master
Are you sure you want to change the base?
Conversation
The panic_abort crate must be compiled with panic=abort, but cargo doesn't allow setting the panic strategy for a single crate. Bootstrap handles this in its rustc wrapper, but for example the build systems of cg_clif and cg_gcc don't use a rustc wrapper, so they would either need to add one or be unable to build a sysroot suitable for both panic=abort and panic=unwind (as is currently the case).
rustbot has assigned @petrochenkov. Use |
It's less of a practical concern, but shouldn't I guess the proper solution would be to move |
Ah, crate loader still searches for |
If panic=abort was used while compiling the standard library, panic_unwind won't be used anyway as any panic=abort dependency will force panic=abort to be used and thus panic_unwind doesn't get linked in.
The LLVM backend needs to know if the current crate uses panic=unwind or panic=abort before any source code gets parsed:
There already is a sanity check that the found crate is a panic runtime: rust/compiler/rustc_metadata/src/creader.rs Lines 999 to 1001 in 862156d
|
The panic_abort crate must be compiled with panic=abort, but cargo doesn't allow setting the panic strategy for a single crate. Bootstrap handles this in its rustc wrapper, but for example the build systems of cg_clif and cg_gcc don't use a rustc wrapper, so they would either need to add one or be unable to build a sysroot suitable for both panic=abort and panic=unwind (as is currently the case).
There is a crate called panic_abort on crates.io that would also be affected by this change. This crate uses unstable features and has last been updated in 2019 however and seems to be meant to be used when you want panic=abort behavior anyway.
Required for rust-lang/rustc_codegen_cranelift#1567