Playground link
I tried this code:
fn main() {
cfg_select! {
true => {
let a = 1 + 1;
}
false => {
let b = 1 + 1;
}
}
}
I expected to see this happen: The selected branch should be marked as an expansion, so Span::from_expansion should return true.
Instead, this happened: The selected branch is pasted directly, without being marked as a macro expansion (or any expansion of any kind). This produces a bug in Clippy.
Meta
rustc --version --verbose:
rustc 1.100.0-nightly (c54751567 2026-08-22)
binary: rustc
commit-hash: c54751567b19c4ceb08b0412d83529c2568cba8b
commit-date: 2026-08-22
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.0
cc rust-lang/rust-clippy#17498 and rust-lang/rust-clippy#17508
cc @folkertdev since you were to one to implement it, maybe you can shine some insights!! (ฅ`・ω・´)っ=
Playground link
I tried this code:
I expected to see this happen: The selected branch should be marked as an expansion, so
Span::from_expansionshould returntrue.Instead, this happened: The selected branch is pasted directly, without being marked as a macro expansion (or any expansion of any kind). This produces a bug in Clippy.
Meta
rustc --version --verbose:cc rust-lang/rust-clippy#17498 and rust-lang/rust-clippy#17508
cc @folkertdev since you were to one to implement it, maybe you can shine some insights!! (ฅ`・ω・´)っ=