]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #37141 - nabeelomer:master, r=sfackler
authorJonathan Turner <jonathandturner@users.noreply.github.com>
Fri, 14 Oct 2016 19:07:08 +0000 (12:07 -0700)
committerGitHub <noreply@github.com>
Fri, 14 Oct 2016 19:07:08 +0000 (12:07 -0700)
Documented that RwLock might panic

Fixes https://github.com/rust-lang/rust/issues/37010

src/libstd/sync/rwlock.rs

index 48ecae185f95c37e9e9a54a3e24c121587bb5fcc..f08b7641521447582b4786c64c7db41c3480268a 100644 (file)
@@ -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 @@ pub fn try_read(&self) -> TryLockResult<RwLockReadGuard<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>> {