diff options
| author | Ralf Jung <post@ralfj.de> | 2024-08-09 18:09:05 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-08-12 10:39:11 +0200 |
| commit | 4763d12207561037847cc7dea4b695f3c129f1d7 (patch) | |
| tree | 656f7077a1f165c9c14117f9debfddf0c132b284 | |
| parent | 9a233bb9dd0783b4819650ed87112dbaf944f353 (diff) | |
| download | rust-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.rs | 4 | ||||
| -rw-r--r-- | library/core/tests/ptr.rs | 9 |
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); + } } } |
