From cd314ab05834518dd20072684081af8afc9edb6c Mon Sep 17 00:00:00 2001 From: Nabeel Omer Date: Thu, 13 Oct 2016 20:37:09 +0530 Subject: [PATCH 1/2] Updated RwLock Docs --- src/libstd/sync/rwlock.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 48ecae185f95c..c5a03f72e2902 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -63,6 +63,9 @@ use sys_common::rwlock as sys; /// assert_eq!(*w, 6); /// } // write lock is dropped here /// ``` +/// # Panics +/// +/// This function might panic when called if the lock is already held by the current thread. #[stable(feature = "rust1", since = "1.0.0")] pub struct RwLock { inner: Box, From b491ddd0f082c7e129ee581a0de3e54ebde9573a Mon Sep 17 00:00:00 2001 From: Nabeel Omer Date: Thu, 13 Oct 2016 21:07:18 +0530 Subject: [PATCH 2/2] Update --- src/libstd/sync/rwlock.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index c5a03f72e2902..f08b764152144 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -63,9 +63,6 @@ use sys_common::rwlock as sys; /// assert_eq!(*w, 6); /// } // write lock is dropped here /// ``` -/// # Panics -/// -/// This function might panic when called if the lock is already held by the current thread. #[stable(feature = "rust1", since = "1.0.0")] pub struct RwLock { inner: Box, @@ -139,6 +136,10 @@ impl RwLock { /// 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> { @@ -191,6 +192,10 @@ impl RwLock { /// 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> {