-
Notifications
You must be signed in to change notification settings - Fork 73
Description
Draft implementation: rust-lang/rust#146317
Proposal
We currently have a standard library feature called panic_immediate_abort
. The goal of this feature is to minimize code size, and it does so by replacing the entire panic runtime with intrinsics::abort()
. For example, on x86 this aborts with just the ud2
instruction, not a call to libc::abort()
. In addition, panic hooks are not called which means that panic messages and backtraces are not printed. Finally, the feature adjusts some inlining attributes on panic wrappers in the standard library so that they completely optimize away.
-Zbuild-std-features=panic_immediate_abort
is really a new panic strategy, kludged in as a standard library feature. I'm proposing that we elevate it to an actual panic option, so that it integrates better with the toolchain. This will let users set the option in the normal way that panics are customized, and let us customize diagnostics about it.
It also opens up opportunities to teach codegen about the panic mode, instead of managing an ever-growing amount of cfg_attr(
in the standard library source.
And if eventually libraries want to customize their behavior to facilitate the code size optimizations that the option opens up, they could use cfg(panic = "immediate_abort")
like the standard library.
Mentors or Reviewers
None
Process
The main points of the Major Change Process are as follows:
- File an issue describing the proposal.
- A compiler team member who is knowledgeable in the area can second by writing
@rustbot second
or kickoff a team FCP with@rfcbot fcp $RESOLUTION
.- Refer to Proposals, Approvals and Stabilization docs for when a second is sufficient, or when a full team FCP is required.
- Once an MCP is seconded, the Final Comment Period begins.
- Final Comment Period lasts for 10 days after all outstanding concerns are solved.
- Outstanding concerns will block the Final Comment Period from finishing. Once all concerns are resolved, the 10 day countdown is restarted.
- If no concerns are raised after 10 days since the resolution of the last outstanding concern, the MCP is considered approved.
You can read more about Major Change Proposals on forge.