rust-lang / rust-lang/rust-clippy

"Lint reasons are experimental" not flagged by clippy for rust-version without support for them

Open
#13,406 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-enhancement
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

Summary

Looked for issues with "rust-version reason" could not find anything.

Asked on zulip here https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Lint.20reasons.20are.20experimental.20not.20detected.20with.20rust-version

reproduced here

Hello I have a project with

rust-version = "1.76"

but it does not seem to detect that allow attributes with "reason" is not available in 1.76, it does not raise an issue in a clippy run, does that sound like a bug ?

was advised to open an issue if I did not find one in the clippy issues. The person advising to open an issue cites "language properties" (like this case) and "trait implementations" as being things clippy does not track very well

Cheers

Reproducer

I tried this code:

#[allow(dead_code, reason = "reproducer for the issue")]
struct MyThing {
    unused_field: bool
}

I expected to see this happen:

Get a warning from clippy given the min rust-version of the project is 1.76 and does not support "allow with reason" (stabilized in 1.81)

Instead, this happened:

No warnings

Version
rustc 1.81.0 (eeb90cda1 2024-09-04)
binary: rustc
commit-hash: eeb90cda1969383f56a2637cbd3037bdf598841c
commit-date: 2024-09-04
host: x86_64-unknown-linux-gnu
release: 1.81.0
LLVM version: 18.1.7
Additional Labels

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied Rust reproducer and the rust-version setting described in the issue. Investigate how Clippy handles language properties and version support for allow attributes with reasons. Done means a Clippy run reports the unsupported attribute when the project's minimum Rust version is 1.76.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.