-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Diagnostic information does not include item attributes #54400
Comments
Here's where we issue the diagnostic: rust/src/librustc_typeck/check_unused.rs Lines 137 to 152 in 2fa1390
Assuming the cfg attribute is actually preserved by earlier passes, then correcting for this case should be easy (look for it in |
…ed_crate, r=estebank in which we include attributes in unused `extern crate` suggestion spans  Resolves rust-lang#54400. r? @estebank
Original rustfix issue: rust-lang/rustfix#147
When rustc outputs warnings like "you don't need this extern crate line anymore, delete it," it doesn't include accompanying attributes. This leads rustfix to apply its suggestion to delete the extern crate line, but leave the attribute, which then gets applied to the next item.
For example:
becomes
which applies the
#[cfg(unix)]
attribute tomod foo;
which is definitely not what was desired.The text was updated successfully, but these errors were encountered: