mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
Fix black_box bug detected by Amanieu
Co-authored-by: Amanieu <amanieu@gmail.com>
This commit is contained in:
parent
87666e5bce
commit
4dc4e9f671
@ -122,7 +122,7 @@ pub fn black_box<T>(mut dummy: T) -> T {
|
|||||||
// SAFETY: the inline assembly is a no-op.
|
// SAFETY: the inline assembly is a no-op.
|
||||||
unsafe {
|
unsafe {
|
||||||
// FIXME: Cannot use `asm!` because it doesn't support MIPS and other architectures.
|
// FIXME: Cannot use `asm!` because it doesn't support MIPS and other architectures.
|
||||||
llvm_asm!("" : : "r"(&mut dummy));
|
llvm_asm!("" : : "r"(&mut dummy) : "memory" : "volatile");
|
||||||
}
|
}
|
||||||
|
|
||||||
dummy
|
dummy
|
||||||
|
Loading…
Reference in New Issue
Block a user