Skip to content

Commit ab699de

Browse files
adamgreigjonas-schievink
authored andcommitted
Mark asm::udf as divergent
1 parent ec3483b commit ab699de

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/asm.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,23 @@ pub fn nop() {
8686
///
8787
/// Can be used as a stable alternative to `core::intrinsics::abort`.
8888
#[inline]
89-
pub fn udf() {
89+
pub fn udf() -> ! {
9090
match () {
9191
#[cfg(all(cortex_m, feature = "inline-asm"))]
92-
() => unsafe { asm!("udf" :::: "volatile") },
92+
() => unsafe {
93+
asm!("udf" :::: "volatile");
94+
loop { continue }
95+
},
9396

9497
#[cfg(all(cortex_m, not(feature = "inline-asm")))]
9598
() => unsafe {
9699
extern "C" {
97100
fn __udf();
98101
}
99102

100-
__udf()
103+
__udf();
104+
105+
loop { continue }
101106
},
102107

103108
#[cfg(not(cortex_m))]

0 commit comments

Comments
 (0)