Skip to content

Commit f54da7a

Browse files
committed
more fixes
1 parent a50858e commit f54da7a

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

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::sync::PoisonError;
2-
31
use crate::cell::UnsafeCell;
42
use crate::fmt;
53
use crate::marker::PhantomData;
@@ -929,8 +927,8 @@ impl<'a, T: ?Sized> RwLockReadGuard<'a, T> {
929927

930928
// SAFETY: We have ownership of the read guard, so it must be in read mode already
931929
match unsafe { read_lock.try_upgrade() } {
932-
true => RwLockWriteGuard::new(read_lock).unwrap_or_else(PoisonError::into_inner),
933-
false => RwLockReadGuard::new(read_lock).unwrap_or_else(PoisonError::into_inner),
930+
true => Ok(RwLockWriteGuard::new(read_lock).unwrap_or_else(PoisonError::into_inner)),
931+
false => Err(RwLockReadGuard::new(read_lock).unwrap_or_else(PoisonError::into_inner)),
934932
}
935933
}
936934
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ impl RwLock {
216216
/// in at least 2 threads will deadlock.
217217
#[inline]
218218
pub unsafe fn try_upgrade(&self) -> bool {
219-
debug_assert!(
219+
debg_assert!(
220220
is_read_locked(self.state),
221221
"RwLock must be read locked to call `try_upgrade`"
222222
);

0 commit comments

Comments
 (0)