mirror of https://github.com/smol-rs/async-lock
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>
This commit is contained in:
parent
d28bdb05eb
commit
1d97f8a887
|
@ -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);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue