@@ -279,11 +279,10 @@ fn do_mir_borrowck<'tcx>(
279
279
& [ ] , // upvars
280
280
IndexVec :: from_elem ( None , & promoted_body. local_decls ) , // local_names
281
281
None , // polonius_output
282
- diags,
282
+ & mut diags,
283
283
) ;
284
284
MoveVisitor { ctxt : & mut promoted_mbcx } . visit_body ( promoted_body) ;
285
285
promoted_mbcx. report_move_errors ( ) ;
286
- diags = promoted_mbcx. diags ;
287
286
288
287
struct MoveVisitor < ' a , ' b , ' infcx , ' tcx > {
289
288
ctxt : & ' a mut MirBorrowckCtxt < ' b , ' infcx , ' tcx > ,
@@ -311,7 +310,7 @@ fn do_mir_borrowck<'tcx>(
311
310
tcx. closure_captures ( def) , // upvars
312
311
local_names,
313
312
polonius_output,
314
- diags,
313
+ & mut diags,
315
314
) ;
316
315
317
316
// Compute and report region errors, if any.
@@ -562,7 +561,7 @@ struct MirBorrowckCtxt<'a, 'infcx, 'tcx> {
562
561
/// Results of Polonius analysis.
563
562
polonius_output : Option < Box < PoloniusOutput > > ,
564
563
565
- diags : diags:: BorrowckDiags < ' infcx , ' tcx > ,
564
+ diags : & ' a mut diags:: BorrowckDiags < ' infcx , ' tcx > ,
566
565
move_errors : Vec < MoveError < ' tcx > > ,
567
566
}
568
567
@@ -580,7 +579,7 @@ impl<'a, 'infcx, 'tcx> MirBorrowckCtxt<'a, 'infcx, 'tcx> {
580
579
upvars : & ' tcx [ & ' tcx ty:: CapturedPlace < ' tcx > ] ,
581
580
local_names : IndexVec < Local , Option < Symbol > > ,
582
581
polonius_output : Option < Box < PoloniusOutput > > ,
583
- diags : diags:: BorrowckDiags < ' infcx , ' tcx > ,
582
+ diags : & ' a mut diags:: BorrowckDiags < ' infcx , ' tcx > ,
584
583
) -> Self {
585
584
MirBorrowckCtxt {
586
585
infcx,
@@ -2524,15 +2523,15 @@ mod diags {
2524
2523
// Buffer any move errors that we collected and de-duplicated.
2525
2524
for ( _, ( _, diag) ) in std:: mem:: take ( & mut self . diags . buffered_move_errors ) {
2526
2525
// We have already set tainted for this error, so just buffer it.
2527
- self . diags . buffered_diags . push ( BufferedDiag :: Error ( diag) ) ;
2526
+ self . diags . buffer_error ( diag) ;
2528
2527
}
2529
2528
for ( _, ( mut diag, count) ) in std:: mem:: take ( & mut self . diags . buffered_mut_errors ) {
2530
2529
if count > 10 {
2531
2530
#[ allow( rustc:: diagnostic_outside_of_impl) ]
2532
2531
#[ allow( rustc:: untranslatable_diagnostic) ]
2533
2532
diag. note ( format ! ( "...and {} other attempted mutable borrows" , count - 10 ) ) ;
2534
2533
}
2535
- self . diags . buffered_diags . push ( BufferedDiag :: Error ( diag) ) ;
2534
+ self . diags . buffer_error ( diag) ;
2536
2535
}
2537
2536
2538
2537
if !self . diags . buffered_diags . is_empty ( ) {
0 commit comments