-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveP-mediumPriority: MediumPriority: Medium
Description
Summary
In our code we take the fn
value std::any::TypeId::of::<something>
in a const context. We later call that function value in a non-const context. This triggers this warning even though our code does not have an MSRV violation.
Lint Name
incompatible_msrv
Reproducer
I tried this code (note that ::of
isn't called: we have of::<()>
not of::<()>()
:
// in `Cargo.toml`
// rust-version = "1.85.1"
const _ : () = {
let _ = std::any::TypeId::of::<()>;
};
I saw this happen:
warning: current MSRV (Minimum Supported Rust Version) is `1.85.1` but this item is stable in a `const` context since `1.91.0`
--> src/lib.rs:3:13
|
3 | let _ = std::any::TypeId::of::<()>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/beta/index.html#incompatible_msrv
= note: `#[warn(clippy::incompatible_msrv)]` on by default
I expected to see this happen:
clippy is happy.
Version
rustc 1.91.0-beta.4 (aa7859c0d 2025-09-27)
binary: rustc
commit-hash: aa7859c0dec2de6c9cab34b03028bcef7b1fc25d
commit-date: 2025-09-27
host: x86_64-unknown-linux-gnu
release: 1.91.0-beta.4
LLVM version: 21.1.1
Additional Labels
@rustbot label +regression-from-stable-to-beta
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveP-mediumPriority: MediumPriority: Medium