-
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 have
Description
Summary
When there is an assembly block with labels in a loop, the never_loop
lint will issue an error if any of those labels unconditionally break or return.
Lint Name
never_loop
Reproducer
I tried this code:
use std::arch::asm;
pub fn repro() {
loop {
unsafe {
asm! {
"/* {} */",
label {
break;
}
}
}
}
}
I saw this happen:
error: this loop never actually loops
--> src/lib.rs:3:5
|
3 | / loop {
4 | | unsafe {
5 | | asm! {
6 | | "/* {} */",
... |
12 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#never_loop
= note: `#[deny(clippy::never_loop)]` on by default
I expected to see this happen:
No error, as the assembly block could (and indeed does) return.
Version
rustc 1.91.0-nightly (4ba1cf9ad 2025-09-12)
binary: rustc
commit-hash: 4ba1cf9ade4c8e2fa10676a50ee34594eb161837
commit-date: 2025-09-12
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.1
Additional Labels
No response
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 have