Skip to content

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

Open
@fmease

Description

@fmease

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.

Activity

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

fmease commented on Mar 21, 2025

@fmease
Author
fmease

fmease commented on Mar 21, 2025

@fmease
MemberAuthor

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

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)[/+] on Mar 21, 2025
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)[/+] on Mar 21, 2025
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)[/+] on Mar 21, 2025
removed
T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
on Mar 21, 2025
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)[/+] on Mar 21, 2025
fmease

fmease commented on Mar 21, 2025

@fmease
MemberAuthor

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @fmease@rustbot

        Issue actions

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