Skip to content

Commit

Permalink
ignore some vtable/fn ptr equality tests in Miri, their result is not…
Browse files Browse the repository at this point in the history
… fully predictable
  • Loading branch information
RalfJung committed Aug 12, 2024
1 parent 9a233bb commit 4763d12
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions library/alloc/tests/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

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

Expand Down
9 changes: 6 additions & 3 deletions library/core/tests/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit 4763d12

Please sign in to comment.