Skip to content

Commit 89ea835

Browse files
committed
Fix RwLock::try_write documentation for WouldBlock condition
The documentation incorrectly stated that try_write only fails when 'already locked exclusively', but it actually fails when there are either shared (read) or exclusive (write) locks. Fixes #142852
1 parent 99b18d6 commit 89ea835

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/std/src/sync/poison/rwlock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ impl<T: ?Sized> RwLock<T> {
481481
/// in the returned error.
482482
///
483483
/// This function will return the [`WouldBlock`] error if the `RwLock` could
484-
/// not be acquired because it was already locked exclusively.
484+
/// not be acquired because it already has a shared or exclusive lock.
485485
///
486486
/// [`Poisoned`]: TryLockError::Poisoned
487487
/// [`WouldBlock`]: TryLockError::WouldBlock

0 commit comments

Comments
 (0)