Closed
Description
Summary
clippy::never_loop is triggering on a loop with a break to a labeled block. i couldnt seem to get a false positive for nested loops with break statements, so its probably a bug specifically with rfc#2046 (stabalized in 1.65).
Lint Name
never_loop
Reproducer
I tried this code:
fn main() {
for _ in 0..10 {
'block: {
break 'block;
return;
}
println!("looped");
}
}
I saw this happen:
error: this loop never actually loops
--> src/main.rs:4:5
|
4 | / for _ in 0..10 {
5 | | 'block: {
6 | | break 'block;
7 | | return;
8 | | }
9 | | println!("looped");
10 | | }
| |_____^
This is in spite of this loop looping 10 times when run.
Version
rustc 1.67.0 (fc594f156 2023-01-24)
binary: rustc
commit-hash: fc594f15669680fa70d255faec3ca3fb507c3405
commit-date: 2023-01-24
host: x86_64-unknown-linux-gnu
release: 1.67.0
LLVM version: 15.0.6
Additional Labels
No response