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

useless_attribute incorrectly triggers for unknown tool attributes on use #13764

Open
lcnr opened this issue Nov 30, 2024 · 0 comments · May be fixed by #13766
Open

useless_attribute incorrectly triggers for unknown tool attributes on use #13764

lcnr opened this issue Nov 30, 2024 · 0 comments · May be fixed by #13766

Comments

@lcnr
Copy link
Contributor

lcnr commented Nov 30, 2024

Description

rust-lang/rust#133643 failed in CI due to an false positive of the useless_attribute lint.

https://github.com/rust-lang/rust/actions/runs/12088915947/job/33713323311

To repro, use the following inside of rustc_middle:

#[allow(rustc::non_glob_import_of_type_ir_inherent)]
use rustc_type_ir::inherent::SliceLike;

This results in

  error: useless lint attribute
    --> compiler/rustc_middle/src/ty/mod.rs:29:1
     |
  29 | #[allow(rustc::non_glob_import_of_type_ir_inherent)]
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: if you just forgot a `!`, use: `#![allow(rustc::non_glob_import_of_type_ir_inherent)]`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_attribute
     = note: `-D clippy::useless-attribute` implied by `-D clippy::correctness`
     = help: to override `-D clippy::correctness` add `#[allow(clippy::useless_attribute)]`

I can imagine us adding an allow-list for lints in the rustc-namespace, however, I believe that in general, this lint should never trigger for lints from unknown namespaces.

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

Successfully merging a pull request may close this issue.

1 participant