@@ -648,7 +648,7 @@ impl Handler {
648
648
// This is here to not allow mutation of flags;
649
649
// as of this writing it's only used in tests in librustc_middle.
650
650
pub fn can_emit_warnings ( & self ) -> bool {
651
- self . inner . lock ( ) . flags . can_emit_warnings
651
+ self . inner . borrow_mut ( ) . flags . can_emit_warnings
652
652
}
653
653
654
654
/// Resets the diagnostic error count as well as the cached emitted diagnostics.
@@ -675,14 +675,13 @@ impl Handler {
675
675
/// Stash a given diagnostic with the given `Span` and [`StashKey`] as the key.
676
676
/// Retrieve a stashed diagnostic with `steal_diagnostic`.
677
677
pub fn stash_diagnostic ( & self , span : Span , key : StashKey , diag : Diagnostic ) {
678
- let mut inner = self . inner . borrow_mut ( ) ;
679
- inner. stash ( ( span. with_parent ( None ) , key) , diag) ;
678
+ self . inner . borrow_mut ( ) . stash ( ( span. with_parent ( None ) , key) , diag) ;
680
679
}
681
680
682
681
/// Steal a previously stashed diagnostic with the given `Span` and [`StashKey`] as the key.
683
682
pub fn steal_diagnostic ( & self , span : Span , key : StashKey ) -> Option < DiagnosticBuilder < ' _ , ( ) > > {
684
- let mut inner = self . inner . borrow_mut ( ) ;
685
- inner
683
+ self . inner
684
+ . borrow_mut ( )
686
685
. steal ( ( span. with_parent ( None ) , key) )
687
686
. map ( |diag| DiagnosticBuilder :: new_diagnostic ( self , diag) )
688
687
}
@@ -1197,8 +1196,7 @@ impl Handler {
1197
1196
mut diag : Diagnostic ,
1198
1197
sp : impl Into < MultiSpan > ,
1199
1198
) -> Option < ErrorGuaranteed > {
1200
- let mut inner = self . inner . borrow_mut ( ) ;
1201
- inner. emit_diagnostic ( diag. set_span ( sp) )
1199
+ self . inner . borrow_mut ( ) . emit_diagnostic ( diag. set_span ( sp) )
1202
1200
}
1203
1201
1204
1202
pub fn emit_artifact_notification ( & self , path : & Path , artifact_type : & str ) {
@@ -1266,7 +1264,7 @@ impl Handler {
1266
1264
}
1267
1265
1268
1266
pub fn flush_delayed ( & self ) {
1269
- let mut inner = self . inner . lock ( ) ;
1267
+ let mut inner = self . inner . borrow_mut ( ) ;
1270
1268
let bugs = std:: mem:: replace ( & mut inner. span_delayed_bugs , Vec :: new ( ) ) ;
1271
1269
inner. flush_delayed ( bugs, "no errors encountered even though `span_delayed_bug` issued" ) ;
1272
1270
}
0 commit comments