File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -246,7 +246,7 @@ pub struct MutexGuard<'a, T: ?Sized> {
246
246
impl < T : ?Sized + fmt:: Debug > fmt:: Debug for MutexGuard < ' _ , T > {
247
247
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
248
248
f. debug_struct ( "MutexGuard" )
249
- . field ( "value" , & * self )
249
+ . field ( "value" , & & * * self )
250
250
. field ( "mutex" , & self . mutex )
251
251
. finish ( )
252
252
}
@@ -292,3 +292,10 @@ unsafe impl<T: ?Sized> Sync for MutexLockFuture<'_, T> {}
292
292
// lock is essentially spinlock-equivalent (attempt to flip an atomic bool)
293
293
unsafe impl < T : ?Sized + Send > Send for MutexGuard < ' _ , T > { }
294
294
unsafe impl < T : ?Sized + Sync > Sync for MutexGuard < ' _ , T > { }
295
+
296
+ #[ test]
297
+ fn test_mutex_guard_debug_not_recurse ( ) {
298
+ let mutex = Mutex :: new ( 42 ) ;
299
+ let guard = mutex. try_lock ( ) . unwrap ( ) ;
300
+ let _ = format ! ( "{:?}" , guard) ;
301
+ }
You can’t perform that action at this time.
0 commit comments