Skip to content

Commit 1572279

Browse files
authored
Rollup merge of rust-lang#119365 - nbdd0121:asm-goto, r=Amanieu
Add asm goto support to `asm!` Tracking issue: rust-lang#119364 This PR implements asm-goto support, using the syntax described in "future possibilities" section of [RFC2873](https://rust-lang.github.io/rfcs/2873-inline-asm.html#asm-goto). Currently I have only implemented the `label` part, not the `fallthrough` part (i.e. fallthrough is implicit). This doesn't reduce the expressive though, since you can use label-break to get arbitrary control flow or simply set a value and rely on jump threading optimisation to get the desired control flow. I can add that later if deemed necessary. r? ``@Amanieu`` cc ``@ojeda``
2 parents 7e83df4 + a4b413d commit 1572279

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

clippy_lints/src/loops/never_loop.rs

+3
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ fn never_loop_expr<'tcx>(
255255
InlineAsmOperand::Const { .. } | InlineAsmOperand::SymFn { .. } | InlineAsmOperand::SymStatic { .. } => {
256256
NeverLoopResult::Normal
257257
},
258+
InlineAsmOperand::Label { block } => {
259+
never_loop_block(cx, block, local_labels, main_loop_id)
260+
}
258261
})),
259262
ExprKind::OffsetOf(_, _)
260263
| ExprKind::Yield(_, _)

clippy_utils/src/hir_utils.rs

+1
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
833833
self.hash_body(anon_const.body);
834834
},
835835
InlineAsmOperand::SymStatic { path, def_id: _ } => self.hash_qpath(path),
836+
InlineAsmOperand::Label { block } => self.hash_block(block),
836837
}
837838
}
838839
},

0 commit comments

Comments
 (0)