@@ -217,26 +217,6 @@ impl<T> Mutex<T> {
217
217
data : UnsafeCell :: new ( t) ,
218
218
}
219
219
}
220
-
221
- /// Immediately drops the guard, and consequently unlocks the mutex.
222
- ///
223
- /// This function is equivalent to calling [`drop`] on the guard but is more self-documenting.
224
- /// Alternately, the guard will be automatically dropped when it goes out of scope.
225
- ///
226
- /// ```
227
- /// #![feature(mutex_unlock)]
228
- ///
229
- /// use std::sync::Mutex;
230
- /// let mutex = Mutex::new(0);
231
- ///
232
- /// let mut guard = mutex.lock().unwrap();
233
- /// *guard += 20;
234
- /// Mutex::unlock(guard);
235
- /// ```
236
- #[ unstable( feature = "mutex_unlock" , issue = "81872" ) ]
237
- pub fn unlock ( guard : MutexGuard < ' _ , T > ) {
238
- drop ( guard) ;
239
- }
240
220
}
241
221
242
222
impl < T : ?Sized > Mutex < T > {
@@ -333,6 +313,26 @@ impl<T: ?Sized> Mutex<T> {
333
313
}
334
314
}
335
315
316
+ /// Immediately drops the guard, and consequently unlocks the mutex.
317
+ ///
318
+ /// This function is equivalent to calling [`drop`] on the guard but is more self-documenting.
319
+ /// Alternately, the guard will be automatically dropped when it goes out of scope.
320
+ ///
321
+ /// ```
322
+ /// #![feature(mutex_unlock)]
323
+ ///
324
+ /// use std::sync::Mutex;
325
+ /// let mutex = Mutex::new(0);
326
+ ///
327
+ /// let mut guard = mutex.lock().unwrap();
328
+ /// *guard += 20;
329
+ /// Mutex::unlock(guard);
330
+ /// ```
331
+ #[ unstable( feature = "mutex_unlock" , issue = "81872" ) ]
332
+ pub fn unlock ( guard : MutexGuard < ' _ , T > ) {
333
+ drop ( guard) ;
334
+ }
335
+
336
336
/// Determines whether the mutex is poisoned.
337
337
///
338
338
/// If another thread is active, the mutex can still become poisoned at any
0 commit comments