Skip to content

Commit c92fc8d

Browse files
committed
Auto merge of rust-lang#75282 - RalfJung:miri-black-box, r=oli-obk
do not call black_box on Miri Helps with rust-lang#75274 (but rust-lang#74932 introduced unrelated breakage that will need a separate fix) Cc @eggyal r? @Mark-Simulacrum
2 parents d19d7e2 + 8385146 commit c92fc8d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

library/core/src/hint.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,11 @@ pub fn black_box<T>(dummy: T) -> T {
119119
// box. This isn't the greatest implementation since it probably deoptimizes
120120
// more than we want, but it's so far good enough.
121121

122+
#[cfg(not(miri))] // This is just a hint, so it is fine to skip in Miri.
122123
// SAFETY: the inline assembly is a no-op.
123124
unsafe {
124125
llvm_asm!("" : : "r"(&dummy));
125-
dummy
126126
}
127+
128+
dummy
127129
}

0 commit comments

Comments
 (0)