diff --git a/library/core/src/hint.rs b/library/core/src/hint.rs index 454fb34e77e49..2ee94a22419a5 100644 --- a/library/core/src/hint.rs +++ b/library/core/src/hint.rs @@ -93,6 +93,15 @@ pub fn spin_loop() { unsafe { crate::arch::arm::__yield() }; } } + // This makes sure that spin_loop is always a side-effect on all platfomrs, + // allowing users to work around https://github.com/rust-lang/rust/issues/28728 + // Remove when that bug is fixed. + #[cfg(not(miri))] + // SAFETY: the inline assembly is a no-op. + unsafe { + // FIXME: Cannot use `asm!` because it doesn't support MIPS and other architectures. + llvm_asm!("" : : : : "volatile"); + } } /// An identity function that *__hints__* to the compiler to be maximally pessimistic about what