ignore some vtable/fn ptr equality tests in Miri, their result is not fully predictable

This commit is contained in:
Ralf Jung 2024-08-09 18:09:05 +02:00
parent 9a233bb9dd
commit 4763d12207
2 changed files with 8 additions and 5 deletions

View File

@ -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;

View File

@ -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);
}
}
}