Skip to content

allow(dead_code) does not work for static externs #38780

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

Closed
Wilfred opened this issue Jan 2, 2017 · 0 comments
Closed

allow(dead_code) does not work for static externs #38780

Wilfred opened this issue Jan 2, 2017 · 0 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@Wilfred
Copy link
Contributor

Wilfred commented Jan 2, 2017

The following Rust code:

extern "C" {
    #[allow(dead_code)]
    static Qt: u64;
}

fn main() {
    println!("hello world");
}

produces the warning:

warning: foreign static item is never used: `Qt`, #[warn(dead_code)] on by default

in spite of the allow(dead_code) annotation.

@sfackler sfackler added the A-diagnostics Area: Messages for errors, warnings, and lints label Jan 2, 2017
dylanmckay pushed a commit to dylanmckay/rust that referenced this issue Jan 3, 2017
…te is present

This functionality was missing, and should have existed previously.

Fixes rust-lang#38780
bors added a commit that referenced this issue Jan 3, 2017
Don't warn about dead foreign items if the 'allow(dead_code)' attribute is present

This functionality was missing, and should have existed previously.

Fixes #38780
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

2 participants