@@ -732,21 +732,10 @@ pub struct RefCell<T: ?Sized> {
732732/// An error returned by [`RefCell::try_borrow`].
733733#[ stable( feature = "try_borrow" , since = "1.13.0" ) ]
734734#[ non_exhaustive]
735+ #[ derive( Debug ) ]
735736pub struct BorrowError {
736737 #[ cfg( feature = "debug_refcell" ) ]
737- location : & ' static crate :: panic:: Location < ' static > ,
738- }
739-
740- #[ stable( feature = "try_borrow" , since = "1.13.0" ) ]
741- impl Debug for BorrowError {
742- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
743- let mut builder = f. debug_struct ( "BorrowError" ) ;
744-
745- #[ cfg( feature = "debug_refcell" ) ]
746- builder. field ( "location" , self . location ) ;
747-
748- builder. finish ( )
749- }
738+ _location : & ' static crate :: panic:: Location < ' static > ,
750739}
751740
752741#[ stable( feature = "try_borrow" , since = "1.13.0" ) ]
@@ -759,21 +748,10 @@ impl Display for BorrowError {
759748/// An error returned by [`RefCell::try_borrow_mut`].
760749#[ stable( feature = "try_borrow" , since = "1.13.0" ) ]
761750#[ non_exhaustive]
751+ #[ derive( Debug ) ]
762752pub struct BorrowMutError {
763753 #[ cfg( feature = "debug_refcell" ) ]
764- location : & ' static crate :: panic:: Location < ' static > ,
765- }
766-
767- #[ stable( feature = "try_borrow" , since = "1.13.0" ) ]
768- impl Debug for BorrowMutError {
769- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
770- let mut builder = f. debug_struct ( "BorrowMutError" ) ;
771-
772- #[ cfg( feature = "debug_refcell" ) ]
773- builder. field ( "location" , self . location ) ;
774-
775- builder. finish ( )
776- }
754+ _location : & ' static crate :: panic:: Location < ' static > ,
777755}
778756
779757#[ stable( feature = "try_borrow" , since = "1.13.0" ) ]
@@ -1036,7 +1014,7 @@ impl<T: ?Sized> RefCell<T> {
10361014 // If a borrow occurred, then we must already have an outstanding borrow,
10371015 // so `borrowed_at` will be `Some`
10381016 #[ cfg( feature = "debug_refcell" ) ]
1039- location : self . borrowed_at . get ( ) . unwrap ( ) ,
1017+ _location : self . borrowed_at . get ( ) . unwrap ( ) ,
10401018 } ) ,
10411019 }
10421020 }
@@ -1125,7 +1103,7 @@ impl<T: ?Sized> RefCell<T> {
11251103 // If a borrow occurred, then we must already have an outstanding borrow,
11261104 // so `borrowed_at` will be `Some`
11271105 #[ cfg( feature = "debug_refcell" ) ]
1128- location : self . borrowed_at . get ( ) . unwrap ( ) ,
1106+ _location : self . borrowed_at . get ( ) . unwrap ( ) ,
11291107 } ) ,
11301108 }
11311109 }
@@ -1255,7 +1233,7 @@ impl<T: ?Sized> RefCell<T> {
12551233 // If a borrow occurred, then we must already have an outstanding borrow,
12561234 // so `borrowed_at` will be `Some`
12571235 #[ cfg( feature = "debug_refcell" ) ]
1258- location : self . borrowed_at . get ( ) . unwrap ( ) ,
1236+ _location : self . borrowed_at . get ( ) . unwrap ( ) ,
12591237 } )
12601238 }
12611239 }
0 commit comments