@@ -173,7 +173,7 @@ fn do_mir_borrowck<'tcx>(
173
173
}
174
174
}
175
175
176
- let mut errors = error :: BorrowckErrors :: new ( ) ;
176
+ let mut diags = diags :: BorrowckDiags :: new ( ) ;
177
177
178
178
// Gather the upvars of a closure, if any.
179
179
if let Some ( e) = input_body. tainted_by_errors {
@@ -243,7 +243,7 @@ fn do_mir_borrowck<'tcx>(
243
243
& regioncx,
244
244
& opt_closure_req,
245
245
& opaque_type_values,
246
- & mut errors ,
246
+ & mut diags ,
247
247
) ;
248
248
249
249
// The various `flow_*` structures can be large. We drop `flow_inits` here
@@ -304,11 +304,11 @@ fn do_mir_borrowck<'tcx>(
304
304
next_region_name : RefCell :: new ( 1 ) ,
305
305
polonius_output : None ,
306
306
move_errors : Vec :: new ( ) ,
307
- errors ,
307
+ diags ,
308
308
} ;
309
309
MoveVisitor { ctxt : & mut promoted_mbcx } . visit_body ( promoted_body) ;
310
310
promoted_mbcx. report_move_errors ( ) ;
311
- errors = promoted_mbcx. errors ;
311
+ diags = promoted_mbcx. diags ;
312
312
313
313
struct MoveVisitor < ' a , ' cx , ' tcx > {
314
314
ctxt : & ' a mut MirBorrowckCtxt < ' cx , ' tcx > ,
@@ -345,7 +345,7 @@ fn do_mir_borrowck<'tcx>(
345
345
next_region_name : RefCell :: new ( 1 ) ,
346
346
polonius_output,
347
347
move_errors : Vec :: new ( ) ,
348
- errors ,
348
+ diags ,
349
349
} ;
350
350
351
351
// Compute and report region errors, if any.
@@ -573,7 +573,7 @@ struct MirBorrowckCtxt<'cx, 'tcx> {
573
573
/// Results of Polonius analysis.
574
574
polonius_output : Option < Rc < PoloniusOutput > > ,
575
575
576
- errors : error :: BorrowckErrors < ' tcx > ,
576
+ diags : diags :: BorrowckDiags < ' tcx > ,
577
577
move_errors : Vec < MoveError < ' tcx > > ,
578
578
}
579
579
@@ -2382,7 +2382,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
2382
2382
}
2383
2383
}
2384
2384
2385
- mod error {
2385
+ mod diags {
2386
2386
use rustc_errors:: ErrorGuaranteed ;
2387
2387
2388
2388
use super :: * ;
@@ -2401,7 +2401,7 @@ mod error {
2401
2401
}
2402
2402
}
2403
2403
2404
- pub struct BorrowckErrors < ' tcx > {
2404
+ pub struct BorrowckDiags < ' tcx > {
2405
2405
/// This field keeps track of move errors that are to be reported for given move indices.
2406
2406
///
2407
2407
/// There are situations where many errors can be reported for a single move out (see
@@ -2425,9 +2425,9 @@ mod error {
2425
2425
buffered_diags : Vec < BufferedDiag < ' tcx > > ,
2426
2426
}
2427
2427
2428
- impl < ' tcx > BorrowckErrors < ' tcx > {
2428
+ impl < ' tcx > BorrowckDiags < ' tcx > {
2429
2429
pub fn new ( ) -> Self {
2430
- BorrowckErrors {
2430
+ BorrowckDiags {
2431
2431
buffered_move_errors : BTreeMap :: new ( ) ,
2432
2432
buffered_mut_errors : Default :: default ( ) ,
2433
2433
buffered_diags : Default :: default ( ) ,
@@ -2445,11 +2445,11 @@ mod error {
2445
2445
2446
2446
impl < ' cx , ' tcx > MirBorrowckCtxt < ' cx , ' tcx > {
2447
2447
pub fn buffer_error ( & mut self , t : DiagnosticBuilder < ' tcx > ) {
2448
- self . errors . buffer_error ( t) ;
2448
+ self . diags . buffer_error ( t) ;
2449
2449
}
2450
2450
2451
2451
pub fn buffer_non_error ( & mut self , t : DiagnosticBuilder < ' tcx , ( ) > ) {
2452
- self . errors . buffer_non_error ( t) ;
2452
+ self . diags . buffer_non_error ( t) ;
2453
2453
}
2454
2454
2455
2455
pub fn buffer_move_error (
@@ -2458,7 +2458,7 @@ mod error {
2458
2458
place_and_err : ( PlaceRef < ' tcx > , DiagnosticBuilder < ' tcx > ) ,
2459
2459
) -> bool {
2460
2460
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)
2462
2462
{
2463
2463
// Cancel the old diagnostic so we don't ICE
2464
2464
diag. cancel ( ) ;
@@ -2472,31 +2472,31 @@ mod error {
2472
2472
& mut self ,
2473
2473
span : Span ,
2474
2474
) -> Option < ( DiagnosticBuilder < ' tcx > , usize ) > {
2475
- self . errors . buffered_mut_errors . remove ( & span)
2475
+ self . diags . buffered_mut_errors . remove ( & span)
2476
2476
}
2477
2477
2478
2478
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) ) ;
2480
2480
}
2481
2481
2482
2482
pub fn emit_errors ( & mut self ) -> Option < ErrorGuaranteed > {
2483
2483
let mut res = None ;
2484
2484
2485
2485
// 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 ) {
2487
2487
// 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) ) ;
2489
2489
}
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 ) {
2491
2491
if count > 10 {
2492
2492
diag. note ( format ! ( "...and {} other attempted mutable borrows" , count - 10 ) ) ;
2493
2493
}
2494
- self . errors . buffered_diags . push ( BufferedDiag :: Error ( diag) ) ;
2494
+ self . diags . buffered_diags . push ( BufferedDiag :: Error ( diag) ) ;
2495
2495
}
2496
2496
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 ( ..) {
2500
2500
match buffered_diag {
2501
2501
BufferedDiag :: Error ( diag) => res = Some ( diag. emit ( ) ) ,
2502
2502
BufferedDiag :: NonError ( diag) => diag. emit ( ) ,
@@ -2508,14 +2508,14 @@ mod error {
2508
2508
}
2509
2509
2510
2510
pub ( crate ) fn has_buffered_diags ( & self ) -> bool {
2511
- self . errors . buffered_diags . is_empty ( )
2511
+ self . diags . buffered_diags . is_empty ( )
2512
2512
}
2513
2513
2514
2514
pub fn has_move_error (
2515
2515
& self ,
2516
2516
move_out_indices : & [ MoveOutIndex ] ,
2517
2517
) -> 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)
2519
2519
}
2520
2520
}
2521
2521
}
0 commit comments