Skip to content

Commit

Permalink
Auto merge of #75282 - RalfJung:miri-black-box, r=oli-obk
Browse files Browse the repository at this point in the history
do not call black_box on Miri

Helps with #75274 (but #74932 introduced unrelated breakage that will need a separate fix)
Cc @eggyal r? @Mark-Simulacrum
  • Loading branch information
bors committed Aug 8, 2020
2 parents d19d7e2 + 8385146 commit c92fc8d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion library/core/src/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit c92fc8d

Please sign in to comment.