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

Undefined lints scoped under rustc don't result in lint unknown-lints getting emitted (unless -Zunstable-options is passed) #138788

Open
fmease opened this issue Mar 21, 2025 · 3 comments
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@fmease
Copy link
Member

fmease commented Mar 21, 2025

While undefined "unscoped" lints lead to the compiler emitting the warn-by-default lint unknown-lints

#![allow(undefined)] //~ WARN unknown lint `undefined`
warning: unknown lint: `undefined`
 --> src/lib.rs:1:10
  |
1 | #![allow(undefined)]
  |          ^^^^^^^^^
  |
  = note: `#[warn(unknown_lints)]` on by default

the same doesn't happen for undefined lints scoped under rustc:

//@ check-pass
#![deny(unknown_lints)]

#![allow(rustc::undefined)]

It would be beneficial if rustc would emit unknown_lints in these cases.

Built-in tools like rustfmt and clippy or tools defined via register_tool are responsible for dealing with undefined lints themselves. However, the ~~tool modules~ lint scope rustc is owned by rustc and should therefore do the checking.

@fmease fmease added A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Mar 21, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 21, 2025
@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 21, 2025
@fmease

This comment has been minimized.

@fmease
Copy link
Member Author

fmease commented Mar 21, 2025

Ooh, it does result in it getting emitted if -Zunstable-options is passed. What on earth?

@fmease fmease changed the title Undefined lints scoped under rustc or rustdoc don't result in lint unknown-lints getting emitted Undefined lints scoped under rustc or rustdoc don't result in lint unknown-lints getting emitted (unless -Zinternal-features is passed) Mar 21, 2025
@fmease fmease changed the title Undefined lints scoped under rustc or rustdoc don't result in lint unknown-lints getting emitted (unless -Zinternal-features is passed) Undefined lints scoped under rustc or rustdoc don't result in lint unknown-lints getting emitted (unless -Zinternal-options is passed) Mar 21, 2025
@fmease fmease changed the title Undefined lints scoped under rustc or rustdoc don't result in lint unknown-lints getting emitted (unless -Zinternal-options is passed) Undefined lints scoped under rustc or rustdoc don't result in lint unknown-lints getting emitted (unless -Zunstable-options is passed) Mar 21, 2025
@fmease fmease removed the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Mar 21, 2025
@fmease fmease changed the title Undefined lints scoped under rustc or rustdoc don't result in lint unknown-lints getting emitted (unless -Zunstable-options is passed) Undefined lints scoped under rustc don't result in lint unknown-lints getting emitted (unless -Zunstable-options is passed) Mar 21, 2025
@fmease
Copy link
Member Author

fmease commented Mar 21, 2025

Actually lint scope rustdoc doesn't have this problem. Updated the issue description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants