Skip to content

Commit dd25442

Browse files
author
Jonathan Turner
authored
Rollup merge of #37141 - nabeelomer:master, r=sfackler
Documented that RwLock might panic Fixes #37010
2 parents 886d47c + b491ddd commit dd25442

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libstd/sync/rwlock.rs

+8
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ impl<T: ?Sized> RwLock<T> {
136136
/// This function will return an error if the RwLock is poisoned. An RwLock
137137
/// is poisoned whenever a writer panics while holding an exclusive lock.
138138
/// The failure will occur immediately after the lock has been acquired.
139+
///
140+
/// # Panics
141+
///
142+
/// This function might panic when called if the lock is already held by the current thread.
139143
#[inline]
140144
#[stable(feature = "rust1", since = "1.0.0")]
141145
pub fn read(&self) -> LockResult<RwLockReadGuard<T>> {
@@ -188,6 +192,10 @@ impl<T: ?Sized> RwLock<T> {
188192
/// This function will return an error if the RwLock is poisoned. An RwLock
189193
/// is poisoned whenever a writer panics while holding an exclusive lock.
190194
/// An error will be returned when the lock is acquired.
195+
///
196+
/// # Panics
197+
///
198+
/// This function might panic when called if the lock is already held by the current thread.
191199
#[inline]
192200
#[stable(feature = "rust1", since = "1.0.0")]
193201
pub fn write(&self) -> LockResult<RwLockWriteGuard<T>> {

0 commit comments

Comments
 (0)