Skip to content

Commit a50858e

Browse files
committed
fix
1 parent a7ddc7b commit a50858e

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Diff for: library/std/src/sync/poison/rwlock.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -921,11 +921,11 @@ impl<'a, T: ?Sized> RwLockReadGuard<'a, T> {
921921
}
922922
}
923923

924-
pub fn try_upgrade<T>(orig: Self) -> Result<RwLockWriteGuard<'a, T>, RwLockReadGuard<'a, T>> {
925-
read_lock = orig.inner_lock;
924+
pub fn try_upgrade(orig: Self) -> Result<RwLockWriteGuard<'a, T>, RwLockReadGuard<'a, T>> {
925+
let read_lock = orig.inner_lock;
926926

927927
// don't call the destructor
928-
forget(read_lock);
928+
forget(orig);
929929

930930
// SAFETY: We have ownership of the read guard, so it must be in read mode already
931931
match unsafe { read_lock.try_upgrade() } {

Diff for: library/std/src/sys/sync/rwlock/futex.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::sync::atomic::Ordering::{Acquire, Relaxed};
2-
31
use crate::sync::atomic::Ordering::{Acquire, Relaxed, Release};
42
use crate::sys::futex::{Futex, Primitive, futex_wait, futex_wake, futex_wake_all};
53

0 commit comments

Comments
 (0)