about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorJonathan Turner <jonathandturner@users.noreply.github.com>2016-10-14 12:07:08 -0700
committerGitHub <noreply@github.com>2016-10-14 12:07:08 -0700
commitdd25442aafff76e87f2158cffb102f98a81d7666 (patch)
tree3691be99ebb5fa9abf772c4ef933d8e7d9af5792 /src/libstd
parent886d47c3ffa9e4d04a305378190bc4592192a0b6 (diff)
parentb491ddd0f082c7e129ee581a0de3e54ebde9573a (diff)
downloadrust-dd25442aafff76e87f2158cffb102f98a81d7666.tar.gz
rust-dd25442aafff76e87f2158cffb102f98a81d7666.zip
Rollup merge of #37141 - nabeelomer:master, r=sfackler
Documented that RwLock might panic

Fixes https://github.com/rust-lang/rust/issues/37010
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/sync/rwlock.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs
index 48ecae185f9..f08b7641521 100644
--- a/src/libstd/sync/rwlock.rs
+++ b/src/libstd/sync/rwlock.rs
@@ -136,6 +136,10 @@ impl<T: ?Sized> RwLock<T> {
     /// This function will return an error if the RwLock is poisoned. An RwLock
     /// is poisoned whenever a writer panics while holding an exclusive lock.
     /// The failure will occur immediately after the lock has been acquired.
+    ///
+    /// # Panics
+    ///
+    /// This function might panic when called if the lock is already held by the current thread.
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn read(&self) -> LockResult<RwLockReadGuard<T>> {
@@ -188,6 +192,10 @@ impl<T: ?Sized> RwLock<T> {
     /// This function will return an error if the RwLock is poisoned. An RwLock
     /// is poisoned whenever a writer panics while holding an exclusive lock.
     /// An error will be returned when the lock is acquired.
+    ///
+    /// # Panics
+    ///
+    /// This function might panic when called if the lock is already held by the current thread.
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn write(&self) -> LockResult<RwLockWriteGuard<T>> {