about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-07-01 21:45:19 +0000
committerbors <bors@rust-lang.org>2021-07-01 21:45:19 +0000
commit56dee7c49ecdec4c2c9eccc6ff966cf58847bda6 (patch)
tree8b0ca08467f70bd8ecacca624c75303d5d3f7ad5 /library/std/src
parent7100b311df0367c4d9067687573d1396b22411df (diff)
parent76bf7c006959ccdf2d161f9113a86491b98e7eae (diff)
downloadrust-56dee7c49ecdec4c2c9eccc6ff966cf58847bda6.tar.gz
rust-56dee7c49ecdec4c2c9eccc6ff966cf58847bda6.zip
Auto merge of #86791 - JohnTitor:rollup-96ltzpz, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #86148 (Check the number of generic lifetime and const parameters of intrinsics)
 - #86659 (fix(rustdoc): generics search)
 - #86768 (Add myself to mailmap)
 - #86775 (Test for const trait impls behind feature gates)
 - #86779 (Allow anyone to add or remove any label starting with perf-)
 - #86783 (Move Mutex::unlock to T: ?Sized)
 - #86785 (proc_macro/bridge: Remove dead code Slice type)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/sync/mutex.rs40
1 files changed, 20 insertions, 20 deletions
diff --git a/library/std/src/sync/mutex.rs b/library/std/src/sync/mutex.rs
index e7c5479ab9b..e1d6324c17e 100644
--- a/library/std/src/sync/mutex.rs
+++ b/library/std/src/sync/mutex.rs
@@ -217,26 +217,6 @@ impl<T> Mutex<T> {
             data: UnsafeCell::new(t),
         }
     }
-
-    /// Immediately drops the guard, and consequently unlocks the mutex.
-    ///
-    /// This function is equivalent to calling [`drop`] on the guard but is more self-documenting.
-    /// Alternately, the guard will be automatically dropped when it goes out of scope.
-    ///
-    /// ```
-    /// #![feature(mutex_unlock)]
-    ///
-    /// use std::sync::Mutex;
-    /// let mutex = Mutex::new(0);
-    ///
-    /// let mut guard = mutex.lock().unwrap();
-    /// *guard += 20;
-    /// Mutex::unlock(guard);
-    /// ```
-    #[unstable(feature = "mutex_unlock", issue = "81872")]
-    pub fn unlock(guard: MutexGuard<'_, T>) {
-        drop(guard);
-    }
 }
 
 impl<T: ?Sized> Mutex<T> {
@@ -333,6 +313,26 @@ impl<T: ?Sized> Mutex<T> {
         }
     }
 
+    /// Immediately drops the guard, and consequently unlocks the mutex.
+    ///
+    /// This function is equivalent to calling [`drop`] on the guard but is more self-documenting.
+    /// Alternately, the guard will be automatically dropped when it goes out of scope.
+    ///
+    /// ```
+    /// #![feature(mutex_unlock)]
+    ///
+    /// use std::sync::Mutex;
+    /// let mutex = Mutex::new(0);
+    ///
+    /// let mut guard = mutex.lock().unwrap();
+    /// *guard += 20;
+    /// Mutex::unlock(guard);
+    /// ```
+    #[unstable(feature = "mutex_unlock", issue = "81872")]
+    pub fn unlock(guard: MutexGuard<'_, T>) {
+        drop(guard);
+    }
+
     /// Determines whether the mutex is poisoned.
     ///
     /// If another thread is active, the mutex can still become poisoned at any