Skip to content

incompatible_msrv false positive: enabled unstable feature #14425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tamird opened this issue Mar 17, 2025 · 1 comment · May be fixed by #14433
Open

incompatible_msrv false positive: enabled unstable feature #14425

tamird opened this issue Mar 17, 2025 · 1 comment · May be fixed by #14433
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@tamird
Copy link
Contributor

tamird commented Mar 17, 2025

Summary

In Rust-for-Linux we want to use provenance but our clippy MSRV is configured as 1.78.0, where e.g. pointer::addr exists but is unstable. We #![feature(strict_provenance)] unconditionally (even when building with rustc where it is stable).

incompatible_msrv fires on this usage when compiling with a compiler where the method is stable but not otherwise. It seems like we want the lint to take enabled features into account.

Lint Name

incompatible_msrv

Reproducer

src/lib.rs:

#![allow(stable_features)]
#![allow(dead_code)]
#![feature(strict_provenance)]

fn addr(ptr: *const u8) -> usize {
  ptr.addr()
}

.clippy.toml:

msrv = "1.78.0"
$ RUSTC_BOOTSTRAP=1 cargo clippy
    Checking msrv-repro v0.1.0 (/Users/tamird/src/msrv-repro)
warning: current MSRV (Minimum Supported Rust Version) is `1.78.0` but this item is stable since `1.84.0`
 --> src/lib.rs:5:9
  |
5 |     ptr.addr()
  |         ^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
  = note: `#[warn(clippy::incompatible_msrv)]` on by default

Version

rustc 1.84.1 (e71f9a9a9 2025-01-27)
binary: rustc
commit-hash: e71f9a9a98b0faf423844bf0ba7438f29dc27d58
commit-date: 2025-01-27
host: aarch64-apple-darwin
release: 1.84.1
LLVM version: 19.1.5

Additional Labels

No response

@tamird tamird added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Mar 17, 2025
@samueltardieu
Copy link
Contributor

There is a discussion about adding an option to ignore some MSRV checks in #14328. This issue is another reason why we might want this new option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants