-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't
Description
Summary
Constant functions in Rust doesn't mean that they are always interpreted during compile time. It just applies some restrictions to make compile time execution possible.
It seems that it was made 3 years ago according to blame of:
Lint Name
cargo::clippy
Reproducer
I tried this code:
#[expect(clippy::panic)]
const fn main() {
panic!("don't")
}
I expected to see no errors emitted.
Instead, this happened:
Checking playground v0.0.1 (/playground)
warning: this lint expectation is unfulfilled
--> src/main.rs:1:10
|
1 | #[expect(clippy::panic)]
| ^^^^^^^^^^^^^
|
= note: `#[warn(unfulfilled_lint_expectations)]` on by default
warning: `playground` (bin "playground") generated 1 warning
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.48s
Version
rustc 1.91.0-nightly (6ba0ce409 2025-08-21)
binary: rustc
commit-hash: 6ba0ce40941eee1ca02e9ba49c791ada5158747a
commit-date: 2025-08-21
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.0
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't