about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--library/core/src/hint.rs4
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
 }