Skip to content
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

dead code lint considers #[used] items unused #41628

Closed
whitequark opened this issue Apr 29, 2017 · 0 comments
Closed

dead code lint considers #[used] items unused #41628

whitequark opened this issue Apr 29, 2017 · 0 comments

Comments

@whitequark
Copy link
Member

To reproduce (a more realistic example would use #[link_section]):

#![feature(used)]
#[used]
static FOO: u32 = 0;
fn main(){}
warning: static item is never used: `FOO`
 --> <anon>:3:1
  |
3 | static FOO: u32 = 0;
  | ^^^^^^^^^^^^^^^^^^^^
  |
  = note: #[warn(dead_code)] on by default
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 30, 2017
Don't ever warn about #[used] items being dead code.

Fixes rust-lang#41628 by whitelisting `#[used]` items in `rustc::middle::dead`.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 30, 2017
Don't ever warn about #[used] items being dead code.

Fixes rust-lang#41628 by whitelisting `#[used]` items in `rustc::middle::dead`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant