Skip to content

Passing -W for an unknown lint gives an error without saying why #74722

Closed
@jyn514

Description

@jyn514
Member
$ rustc -W unknown_blah ~/src/test-rustdoc/test.rs 
error[E0602]: unknown lint: `unknown_blah`
  |
  = note: requested on the command line with `-W unknown_blah`

Not sure if this is actually a bug? cc @Mark-Simulacrum

Activity

Mark-Simulacrum

Mark-Simulacrum commented on Jul 24, 2020

@Mark-Simulacrum
Member

We should at least give a brief blurb about how to silence this. (Does -Wunknown-lints help?)

added
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.
C-enhancementCategory: An issue proposing an enhancement or a PR with one.
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Jul 24, 2020
jyn514

jyn514 commented on Feb 9, 2021

@jyn514
MemberAuthor

(Does -Wunknown-lints help?)

It does not.

$ rustc -Aunknown-lints -Alegacy-derive-helpers hello.rs
error[E0602]: unknown lint: `legacy_derive_helpers`
  |
  = note: requested on the command line with `-A legacy_derive_helpers`
added
A-driverArea: rustc_driver that ties everything together into the `rustc` compiler
on Feb 9, 2021
tmandry

tmandry commented on Feb 9, 2021

@tmandry
Member

Copying what I said in #81906:

Since the same problem that unknown-lints solves exists on the command line, I'd argue that this is a bug in the CLI.

As a corollary, it would be nice if we could do something like -Aunknown-lints -Alegacy-derive-helpers -Dunknown-lints to prevent misspellings elsewhere in the command line.

djkoloski

djkoloski commented on Feb 24, 2022

@djkoloski
Contributor

#94274 fixes the issue of -Aunknown-lints not applying to subsequent CLI arguments.

Herschel

Herschel commented on May 22, 2022

@Herschel
Contributor

I ran into this when adopting Embark's workaround for using .cargo/config.toml to allow/disable lints for an entire workspace via rustflags. I'd like to -Aunknown_lints here and then squelch certain nightly clippy lints, but subsequent -Afoobar still give me errors.

#94274 fixes the issue of -Aunknown-lints not applying to subsequent CLI arguments.

This makes it sound like the above should work correctly, but I guess I'm mistaken? rustc 1.63.0-nightly (9257f5a 2022-05-21)

ComputerDruid

ComputerDruid commented on May 23, 2022

@ComputerDruid
Contributor

I think #94274 only helps with unstable lints, not unknown ones, unfortunately.

added
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.
and removed
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.
on Dec 21, 2024
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-driverArea: rustc_driver that ties everything together into the `rustc` compilerA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.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

      Participants

      @ComputerDruid@Herschel@tmandry@Mark-Simulacrum@djkoloski

      Issue actions

        Passing -W for an unknown lint gives an error without saying why · Issue #74722 · rust-lang/rust