-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thing
Description
Summary
invalid_upcast_comparisons wrongly showed macro definition instead of invocation.
Reproducer
I tried this code:
macro_rules! add_one {
($x:expr) => {
$x + 1
};
}
let x: u8 = 1;
(add_one!(x) as u32) > 300;I expected to see this happen:
error: because of the numeric bounds on `add_one!(x)` prior to casting, this expression is always false
--> src/main.rs:13:5
|
13 | (add_one!(x) as u32) > 300;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#invalid_upcast_comparisons
Instead, this happened:
error: because of the numeric bounds on `$x + 1` prior to casting, this expression is always false
--> src/main.rs:13:5
|
13 | (add_one!(x) as u32) > 300;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#invalid_upcast_comparisons
Version
rustc 1.91.0-nightly (a1208bf76 2025-09-03)
binary: rustc
commit-hash: a1208bf765ba783ee4ebdc4c29ab0a0c215806ef
commit-date: 2025-09-03
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.0
Additional Labels
No response
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thing