about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-08-09 18:09:05 +0200
committerRalf Jung <post@ralfj.de>2024-08-12 10:39:11 +0200
commit4763d12207561037847cc7dea4b695f3c129f1d7 (patch)
tree656f7077a1f165c9c14117f9debfddf0c132b284
parent9a233bb9dd0783b4819650ed87112dbaf944f353 (diff)
downloadrust-4763d12207561037847cc7dea4b695f3c129f1d7.tar.gz
rust-4763d12207561037847cc7dea4b695f3c129f1d7.zip
ignore some vtable/fn ptr equality tests in Miri, their result is not fully predictable
-rw-r--r--library/alloc/tests/task.rs4
-rw-r--r--library/core/tests/ptr.rs9
2 files changed, 8 insertions, 5 deletions
diff --git a/library/alloc/tests/task.rs b/library/alloc/tests/task.rs
index 034039a1eae..390dec14484 100644
--- a/library/alloc/tests/task.rs
+++ b/library/alloc/tests/task.rs
@@ -4,7 +4,7 @@ use alloc::task::{LocalWake, Wake};
 use core::task::{LocalWaker, Waker};
 
 #[test]
-#[cfg_attr(miri, should_panic)] // `will_wake` doesn't guarantee that this test will work, and indeed on Miri it fails
+#[cfg_attr(miri, ignore)] // `will_wake` doesn't guarantee that this test will work, and indeed on Miri it can fail
 fn test_waker_will_wake_clone() {
     struct NoopWaker;
 
@@ -20,7 +20,7 @@ fn test_waker_will_wake_clone() {
 }
 
 #[test]
-#[cfg_attr(miri, should_panic)] // `will_wake` doesn't guarantee that this test will work, and indeed on Miri it fails
+#[cfg_attr(miri, ignore)] // `will_wake` doesn't guarantee that this test will work, and indeed on Miri it can fail
 fn test_local_waker_will_wake_clone() {
     struct NoopWaker;
 
diff --git a/library/core/tests/ptr.rs b/library/core/tests/ptr.rs
index bc1940ebf32..78d1b137e63 100644
--- a/library/core/tests/ptr.rs
+++ b/library/core/tests/ptr.rs
@@ -810,9 +810,12 @@ fn ptr_metadata() {
         assert_ne!(address_1, address_2);
         // Different erased type => different vtable pointer
         assert_ne!(address_2, address_3);
-        // Same erased type and same trait => same vtable pointer
-        assert_eq!(address_3, address_4);
-        assert_eq!(address_3, address_5);
+        // Same erased type and same trait => same vtable pointer.
+        // This is *not guaranteed*, so we skip it in Miri.
+        if !cfg!(miri) {
+            assert_eq!(address_3, address_4);
+            assert_eq!(address_3, address_5);
+        }
     }
 }