Skip to content

Use EII for #[panic_handler]#159016

Draft
bjorn3 wants to merge 5 commits into
rust-lang:mainfrom
bjorn3:eii_panic_handler
Draft

Use EII for #[panic_handler]#159016
bjorn3 wants to merge 5 commits into
rust-lang:mainfrom
bjorn3:eii_panic_handler

Conversation

@bjorn3

@bjorn3 bjorn3 commented Jul 9, 2026

Copy link
Copy Markdown
Member

While we can't yet use EIIs for things like the global allocator due to missing platform support, we can safely use it for #[panic_handler] as that doesn't require any object file format features. Just matching symbol names.

This gets rid of one of the two remaining weak lang items.

TODO

  • Support EII without defaults in cg_clif and cg_gcc. This can be done without requiring any (weak) symbol alias support.
  • #[no_mangle] is not denied on EII definitions #159015 to avoid accepting some invalid code.
  • Possibly improve the error for applying #[target_feature] on the panic handler.

bjorn3 added 4 commits July 9, 2026 15:06
The only way it was possible to skip needing to declare #[panic_handler]
is using #![no_core], which is unstable anyway. Always requiring
\#[panic_handler] makes things more consistent and avoids having to
special case several MIR optimizations for the absence of #[panic_handler].
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-test-infra-minicore Area: `minicore` test auxiliary and `//@ add-core-stubs` S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 9, 2026
@bjorn3

bjorn3 commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

cc @jdonszelmann

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@rust-bors

rust-bors Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #159113) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-test-infra-minicore Area: `minicore` test auxiliary and `//@ add-core-stubs` S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants