Skip to content

unused_features triggers on stable lint_reasons despite usage #153523

@BennoLossin

Description

@BennoLossin

I tried this code:

#![deny(warnings)]
#![allow(stable_features)]
#![feature(lint_reasons)]

#[allow(unused_variables, reason = "my reason")]
fn main() {
    let x = ();
}

I expected to see this happen: no error emitted

Instead, this happened: Error:

error: feature `lint_reasons` is declared but not used
 --> src/main.rs:3:12
  |
3 | #![feature(lint_reasons)]
  |            ^^^^^^^^^^^^
  |
note: the lint level is defined here
 --> src/main.rs:1:9
  |
1 | #![deny(warnings)]
  |         ^^^^^^^^
  = note: `#[deny(unused_features)]` implied by `#[deny(warnings)]`

Meta

rustc --version --verbose:

rustc 1.96.0-nightly (80282b130 2026-03-06)
binary: rustc
commit-hash: 80282b130679a654eaa22f028a908c51be53d436
commit-date: 2026-03-06
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.0

Metadata

Metadata

Assignees

Labels

A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-discussionCategory: Discussion or questions that doesn't represent real issues.F-lint_reasons`#![feature(lint_reasons)]`L-unused_featuresLint: unused_featuresT-langRelevant to the language team

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions