@@ -173,7 +173,7 @@ fn do_mir_borrowck<'tcx>(
173173 }
174174 }
175175
176- let mut errors = error :: BorrowckErrors :: new ( ) ;
176+ let mut diags = diags :: BorrowckDiags :: new ( ) ;
177177
178178 // Gather the upvars of a closure, if any.
179179 if let Some ( e) = input_body. tainted_by_errors {
@@ -243,7 +243,7 @@ fn do_mir_borrowck<'tcx>(
243243 & regioncx,
244244 & opt_closure_req,
245245 & opaque_type_values,
246- & mut errors ,
246+ & mut diags ,
247247 ) ;
248248
249249 // The various `flow_*` structures can be large. We drop `flow_inits` here
@@ -304,11 +304,11 @@ fn do_mir_borrowck<'tcx>(
304304 next_region_name : RefCell :: new ( 1 ) ,
305305 polonius_output : None ,
306306 move_errors : Vec :: new ( ) ,
307- errors ,
307+ diags ,
308308 } ;
309309 MoveVisitor { ctxt : & mut promoted_mbcx } . visit_body ( promoted_body) ;
310310 promoted_mbcx. report_move_errors ( ) ;
311- errors = promoted_mbcx. errors ;
311+ diags = promoted_mbcx. diags ;
312312
313313 struct MoveVisitor < ' a , ' cx , ' tcx > {
314314 ctxt : & ' a mut MirBorrowckCtxt < ' cx , ' tcx > ,
@@ -345,7 +345,7 @@ fn do_mir_borrowck<'tcx>(
345345 next_region_name : RefCell :: new ( 1 ) ,
346346 polonius_output,
347347 move_errors : Vec :: new ( ) ,
348- errors ,
348+ diags ,
349349 } ;
350350
351351 // Compute and report region errors, if any.
@@ -573,7 +573,7 @@ struct MirBorrowckCtxt<'cx, 'tcx> {
573573 /// Results of Polonius analysis.
574574 polonius_output : Option < Rc < PoloniusOutput > > ,
575575
576- errors : error :: BorrowckErrors < ' tcx > ,
576+ diags : diags :: BorrowckDiags < ' tcx > ,
577577 move_errors : Vec < MoveError < ' tcx > > ,
578578}
579579
@@ -2382,7 +2382,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
23822382 }
23832383}
23842384
2385- mod error {
2385+ mod diags {
23862386 use rustc_errors:: ErrorGuaranteed ;
23872387
23882388 use super :: * ;
@@ -2401,7 +2401,7 @@ mod error {
24012401 }
24022402 }
24032403
2404- pub struct BorrowckErrors < ' tcx > {
2404+ pub struct BorrowckDiags < ' tcx > {
24052405 /// This field keeps track of move errors that are to be reported for given move indices.
24062406 ///
24072407 /// There are situations where many errors can be reported for a single move out (see
@@ -2425,9 +2425,9 @@ mod error {
24252425 buffered_diags : Vec < BufferedDiag < ' tcx > > ,
24262426 }
24272427
2428- impl < ' tcx > BorrowckErrors < ' tcx > {
2428+ impl < ' tcx > BorrowckDiags < ' tcx > {
24292429 pub fn new ( ) -> Self {
2430- BorrowckErrors {
2430+ BorrowckDiags {
24312431 buffered_move_errors : BTreeMap :: new ( ) ,
24322432 buffered_mut_errors : Default :: default ( ) ,
24332433 buffered_diags : Default :: default ( ) ,
@@ -2445,11 +2445,11 @@ mod error {
24452445
24462446 impl < ' cx , ' tcx > MirBorrowckCtxt < ' cx , ' tcx > {
24472447 pub fn buffer_error ( & mut self , t : DiagnosticBuilder < ' tcx > ) {
2448- self . errors . buffer_error ( t) ;
2448+ self . diags . buffer_error ( t) ;
24492449 }
24502450
24512451 pub fn buffer_non_error ( & mut self , t : DiagnosticBuilder < ' tcx , ( ) > ) {
2452- self . errors . buffer_non_error ( t) ;
2452+ self . diags . buffer_non_error ( t) ;
24532453 }
24542454
24552455 pub fn buffer_move_error (
@@ -2458,7 +2458,7 @@ mod error {
24582458 place_and_err : ( PlaceRef < ' tcx > , DiagnosticBuilder < ' tcx > ) ,
24592459 ) -> bool {
24602460 if let Some ( ( _, diag) ) =
2461- self . errors . buffered_move_errors . insert ( move_out_indices, place_and_err)
2461+ self . diags . buffered_move_errors . insert ( move_out_indices, place_and_err)
24622462 {
24632463 // Cancel the old diagnostic so we don't ICE
24642464 diag. cancel ( ) ;
@@ -2472,31 +2472,31 @@ mod error {
24722472 & mut self ,
24732473 span : Span ,
24742474 ) -> Option < ( DiagnosticBuilder < ' tcx > , usize ) > {
2475- self . errors . buffered_mut_errors . remove ( & span)
2475+ self . diags . buffered_mut_errors . remove ( & span)
24762476 }
24772477
24782478 pub fn buffer_mut_error ( & mut self , span : Span , t : DiagnosticBuilder < ' tcx > , count : usize ) {
2479- self . errors . buffered_mut_errors . insert ( span, ( t, count) ) ;
2479+ self . diags . buffered_mut_errors . insert ( span, ( t, count) ) ;
24802480 }
24812481
24822482 pub fn emit_errors ( & mut self ) -> Option < ErrorGuaranteed > {
24832483 let mut res = None ;
24842484
24852485 // Buffer any move errors that we collected and de-duplicated.
2486- for ( _, ( _, diag) ) in std:: mem:: take ( & mut self . errors . buffered_move_errors ) {
2486+ for ( _, ( _, diag) ) in std:: mem:: take ( & mut self . diags . buffered_move_errors ) {
24872487 // We have already set tainted for this error, so just buffer it.
2488- self . errors . buffered_diags . push ( BufferedDiag :: Error ( diag) ) ;
2488+ self . diags . buffered_diags . push ( BufferedDiag :: Error ( diag) ) ;
24892489 }
2490- for ( _, ( mut diag, count) ) in std:: mem:: take ( & mut self . errors . buffered_mut_errors ) {
2490+ for ( _, ( mut diag, count) ) in std:: mem:: take ( & mut self . diags . buffered_mut_errors ) {
24912491 if count > 10 {
24922492 diag. note ( format ! ( "...and {} other attempted mutable borrows" , count - 10 ) ) ;
24932493 }
2494- self . errors . buffered_diags . push ( BufferedDiag :: Error ( diag) ) ;
2494+ self . diags . buffered_diags . push ( BufferedDiag :: Error ( diag) ) ;
24952495 }
24962496
2497- if !self . errors . buffered_diags . is_empty ( ) {
2498- self . errors . buffered_diags . sort_by_key ( |buffered_diag| buffered_diag. sort_span ( ) ) ;
2499- for buffered_diag in self . errors . buffered_diags . drain ( ..) {
2497+ if !self . diags . buffered_diags . is_empty ( ) {
2498+ self . diags . buffered_diags . sort_by_key ( |buffered_diag| buffered_diag. sort_span ( ) ) ;
2499+ for buffered_diag in self . diags . buffered_diags . drain ( ..) {
25002500 match buffered_diag {
25012501 BufferedDiag :: Error ( diag) => res = Some ( diag. emit ( ) ) ,
25022502 BufferedDiag :: NonError ( diag) => diag. emit ( ) ,
@@ -2508,14 +2508,14 @@ mod error {
25082508 }
25092509
25102510 pub ( crate ) fn has_buffered_diags ( & self ) -> bool {
2511- self . errors . buffered_diags . is_empty ( )
2511+ self . diags . buffered_diags . is_empty ( )
25122512 }
25132513
25142514 pub fn has_move_error (
25152515 & self ,
25162516 move_out_indices : & [ MoveOutIndex ] ,
25172517 ) -> Option < & ( PlaceRef < ' tcx > , DiagnosticBuilder < ' tcx > ) > {
2518- self . errors . buffered_move_errors . get ( move_out_indices)
2518+ self . diags . buffered_move_errors . get ( move_out_indices)
25192519 }
25202520 }
25212521}
0 commit comments