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:
commit
c92fc8db8b
1 changed files with 3 additions and 1 deletions
|
@ -119,9 +119,11 @@ pub fn black_box<T>(dummy: T) -> T {
|
||||||
// box. This isn't the greatest implementation since it probably deoptimizes
|
// box. This isn't the greatest implementation since it probably deoptimizes
|
||||||
// more than we want, but it's so far good enough.
|
// 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.
|
// SAFETY: the inline assembly is a no-op.
|
||||||
unsafe {
|
unsafe {
|
||||||
llvm_asm!("" : : "r"(&dummy));
|
llvm_asm!("" : : "r"(&dummy));
|
||||||
dummy
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dummy
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue