Skip to content

incompatible_msrv false positive: enabled unstable feature #14425

Open
@tamird

Description

@tamird

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions