make black_box a NOP in Miri
This commit is contained in:
parent
e61621c307
commit
8385146ffa
@ -119,9 +119,11 @@ pub fn black_box<T>(dummy: T) -> T {
|
||||
// box. This isn't the greatest implementation since it probably deoptimizes
|
||||
// more than we want, but it's so far good enough.
|
||||
|
||||
#[cfg(not(miri))] // This is just a hint, so it is fine to skip in Miri.
|
||||
// SAFETY: the inline assembly is a no-op.
|
||||
unsafe {
|
||||
llvm_asm!("" : : "r"(&dummy));
|
||||
}
|
||||
|
||||
dummy
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user