@@ -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,22 +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- write ! ( f, "{}" , self . location)
771- // let mut builder = f.debug_struct("BorrowMutError");
772-
773- // #[cfg(feature = "debug_refcell")]
774- // builder.field("location", self.location);
775-
776- // builder.finish()
777- }
754+ _location : & ' static crate :: panic:: Location < ' static > ,
778755}
779756
780757#[ stable( feature = "try_borrow" , since = "1.13.0" ) ]
@@ -1045,7 +1022,7 @@ impl<T: ?Sized> RefCell<T> {
10451022 // If a borrow occurred, then we must already have an outstanding borrow,
10461023 // so `borrowed_at` will be `Some`
10471024 #[ cfg( feature = "debug_refcell" ) ]
1048- location : self . borrowed_at . get ( ) . unwrap ( ) ,
1025+ _location : self . borrowed_at . get ( ) . unwrap ( ) ,
10491026 } ) ,
10501027 }
10511028 }
@@ -1134,7 +1111,7 @@ impl<T: ?Sized> RefCell<T> {
11341111 // If a borrow occurred, then we must already have an outstanding borrow,
11351112 // so `borrowed_at` will be `Some`
11361113 #[ cfg( feature = "debug_refcell" ) ]
1137- location : self . borrowed_at . get ( ) . unwrap ( ) ,
1114+ _location : self . borrowed_at . get ( ) . unwrap ( ) ,
11381115 } ) ,
11391116 }
11401117 }
@@ -1264,7 +1241,7 @@ impl<T: ?Sized> RefCell<T> {
12641241 // If a borrow occurred, then we must already have an outstanding borrow,
12651242 // so `borrowed_at` will be `Some`
12661243 #[ cfg( feature = "debug_refcell" ) ]
1267- location : self . borrowed_at . get ( ) . unwrap ( ) ,
1244+ _location : self . borrowed_at . get ( ) . unwrap ( ) ,
12681245 } )
12691246 }
12701247 }
0 commit comments