Compare commits

...

2 Commits

Author SHA1 Message Date
John Nunley dcdbd3fa98
Merge 1d97f8a887 into 47dd439e5a 2024-01-31 05:02:15 +00:00
John Nunley 1d97f8a887
Fix Miri tests
- Miri was catching what I now know to be a legitimate leak, so I've
  fixed that.
- The deadlock doesn't appear to be legitimate; replacing the futures
  with their blocking equivalents passes. I've marked these tests as
  skipped on MIRI for now.

Signed-off-by: John Nunley <dev@notgull.net>
2024-01-30 21:02:01 -08:00
2 changed files with 12 additions and 5 deletions

View File

@ -426,13 +426,18 @@ pin_project_lite::pin_project! {
impl<T: ?Sized> PinnedDrop for UpgradeArcInner<T> {
fn drop(this: Pin<&mut Self>) {
let this = this.project();
if !this.raw.is_ready() {
let is_ready = this.raw.is_ready();
// SAFETY: The drop impl for raw assumes that it is pinned.
unsafe {
ManuallyDrop::drop(this.raw.get_unchecked_mut());
}
if !is_ready {
// SAFETY: we drop the `Arc` (decrementing the reference count)
// only if this future was cancelled before returning an
// upgraded lock.
unsafe {
// SAFETY: The drop impl for raw assumes that it is pinned.
ManuallyDrop::drop(this.raw.get_unchecked_mut());
ManuallyDrop::drop(this.lock);
};
}

View File

@ -120,7 +120,8 @@ fn get_mut() {
assert_eq!(lock.into_inner(), 20);
}
#[cfg(not(target_family = "wasm"))]
// Miri bug; this works when async is replaced with blocking
#[cfg(not(any(target_family = "wasm", miri)))]
#[test]
fn contention() {
const N: u32 = 10;
@ -154,7 +155,8 @@ fn contention() {
});
}
#[cfg(not(target_family = "wasm"))]
// Miri bug; this works when async is replaced with blocking
#[cfg(not(any(target_family = "wasm", miri)))]
#[test]
fn contention_arc() {
const N: u32 = 10;