Skip to content

Unstable lints passed on command line can only be ungated from source code #113702

@petrochenkov

Description

@petrochenkov

I tried this code:

rustc hello_world.rs -Wunnameable_types -Zunstable-options

I expected to see this happen:

Successful compilation, no warnings.

Instead, this happened:

$ rustc hello.rs -Wunnameable_types -Zunstable-options
warning: unknown lint: `unnameable_types`
  |
  = note: the `unnameable_types` lint is unstable
  = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
  = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
  = note: `#[warn(unknown_lints)]` on by default

The warnings can only be removed by

  • either additionally passing -Aunknown_lints, which is bad,
  • or adding #![feature(type_privacy_lints)] to source code of all crates in which we want to enable the lint, which may be dozens or hundreds crates like in case of Enable type privacy lints in rustc #113284, making this alternative even worse than the first one.

Warnings about unstable lints passed from command line should be silence-able from command line as well, with something like -Zunstable-options.

Meta

rustc --version --verbose:

rustc 1.73.0-nightly (7bd81ee19 2023-07-13)
binary: rustc
commit-hash: 7bd81ee1902c049691d0a1f03be5558bee51d100
commit-date: 2023-07-13
host: x86_64-pc-windows-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-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

    Issue actions