diff options
| author | bors <bors@rust-lang.org> | 2020-08-08 09:46:16 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-08-08 09:46:16 +0000 |
| commit | c92fc8db8b009b7661cff31fa59a7c0348653bd0 (patch) | |
| tree | 75c73eebcb1ac1015c651bade30c0531f1ba9875 | |
| parent | d19d7e27552b8da17932384b8db53927a1f4e00e (diff) | |
| parent | 8385146ffaddd90d79dff28d7924140ba079adfa (diff) | |
| download | rust-c92fc8db8b009b7661cff31fa59a7c0348653bd0.tar.gz rust-c92fc8db8b009b7661cff31fa59a7c0348653bd0.zip | |
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
| -rw-r--r-- | library/core/src/hint.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/library/core/src/hint.rs b/library/core/src/hint.rs index 3116815f5d6..3dc0ee2b555 100644 --- a/library/core/src/hint.rs +++ b/library/core/src/hint.rs @@ -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 } |
