Auto merge of #75282 - RalfJung:miri-black-box, r=oli-obk

do not call black_box on Miri

Helps with https://github.com/rust-lang/rust/issues/75274 (but https://github.com/rust-lang/rust/pull/74932 introduced unrelated breakage that will need a separate fix)
Cc @eggyal r? @Mark-Simulacrum
This commit is contained in:
bors 2020-08-08 09:46:16 +00:00
commit c92fc8db8b

View File

@ -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
}
dummy
}