Skip to content

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

Closed
@phil-opp

Description

@phil-opp
Contributor

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.)

Activity

Centril

Centril commented on Oct 7, 2018

@Centril
Contributor
added
P-highHigh priority
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Oct 8, 2018
japaric

japaric commented on Oct 9, 2018

@japaric
Member

I'm very busy this week and probably won't have time to look at this until next Wednesday but if someone wants to take a stab at this I would look for the logic used by #[global_allocator]: that attribute gives you "error: allocators must be statics" when applied to non-static items.

pnkfelix

pnkfelix commented on Oct 11, 2018

@pnkfelix
Member

Visited for triage. Does not seem super critical to resolve immediately. Putting on the Release milestone (rather than RC2) to reflect this, and also downgrading priority to P-medium.

added this to the Rust 2018 Release milestone on Oct 11, 2018
added and removed
P-highHigh priority
on Oct 11, 2018
self-assigned this
on Oct 11, 2018
added a commit that references this issue on Oct 13, 2018

Auto merge of #54997 - davidtwco:issue-54896, r=nagisa

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

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

      Participants

      @pnkfelix@Centril@phil-opp@davidtwco@japaric

      Issue actions

        The #[panic_handler] attribute can be applied to non-functions · Issue #54896 · rust-lang/rust