Skip to content

The #[panic_handler] attribute can be applied to non-functions #54896

Closed
@phil-opp

Description

@phil-opp

It's possible to apply the panic_handler attribute to an extern crate statement without errror:

#[panic_handler]
extern crate some_example_crate;

It only causes a linker error:

rust-lld: error: undefined symbol: rust_begin_unwind

(When the panic_handler attribute is not defined there is a much better "#[panic_handler] function required, but not found" error. There is also a nice error when the function signature is wrong. But it seems like the above case is not handled.)

Metadata

Metadata

Assignees

Labels

P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions