@@ -58,17 +58,17 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
58
58
Some ( name) => format ! ( "`{}`" , name) ,
59
59
None => "value" . to_owned ( ) ,
60
60
} ;
61
- self . tcx
61
+ let mut err = self . tcx
62
62
. cannot_act_on_uninitialized_variable (
63
63
span,
64
64
desired_action. as_noun ( ) ,
65
65
& self
66
66
. describe_place_with_options ( place, IncludingDowncast ( true ) )
67
67
. unwrap_or ( "_" . to_owned ( ) ) ,
68
68
Origin :: Mir ,
69
- )
70
- . span_label ( span, format ! ( "use of possibly uninitialized {}" , item_msg) )
71
- . emit ( ) ;
69
+ ) ;
70
+ err . span_label ( span, format ! ( "use of possibly uninitialized {}" , item_msg) ) ;
71
+ err . buffer ( & mut self . errors_buffer ) ;
72
72
} else {
73
73
let msg = "" ; //FIXME: add "partially " or "collaterally "
74
74
@@ -143,7 +143,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
143
143
}
144
144
}
145
145
146
- err. emit ( ) ;
146
+ err. buffer ( & mut self . errors_buffer ) ;
147
147
}
148
148
}
149
149
@@ -173,7 +173,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
173
173
) ;
174
174
err. span_label ( span, format ! ( "move out of {} occurs here" , value_msg) ) ;
175
175
self . explain_why_borrow_contains_point ( context, borrow, None , & mut err) ;
176
- err. emit ( ) ;
176
+ err. buffer ( & mut self . errors_buffer ) ;
177
177
}
178
178
179
179
pub ( super ) fn report_use_while_mutably_borrowed (
@@ -194,8 +194,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
194
194
) ;
195
195
196
196
self . explain_why_borrow_contains_point ( context, borrow, None , & mut err) ;
197
-
198
- err. emit ( ) ;
197
+ err. buffer ( & mut self . errors_buffer ) ;
199
198
}
200
199
201
200
/// Finds the span of arguments of a closure (within `maybe_closure_span`) and its usage of
@@ -391,7 +390,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
391
390
392
391
self . explain_why_borrow_contains_point ( context, issued_borrow, None , & mut err) ;
393
392
394
- err. emit ( ) ;
393
+ err. buffer ( & mut self . errors_buffer ) ;
395
394
}
396
395
397
396
pub ( super ) fn report_borrowed_value_does_not_live_long_enough (
@@ -513,7 +512,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
513
512
format ! ( "`{}` dropped here while still borrowed" , name) ,
514
513
) ;
515
514
self . explain_why_borrow_contains_point ( context, borrow, None , & mut err) ;
516
- err. emit ( ) ;
515
+ err. buffer ( & mut self . errors_buffer ) ;
517
516
}
518
517
519
518
fn report_scoped_temporary_value_does_not_live_long_enough (
@@ -535,7 +534,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
535
534
) ;
536
535
err. note ( "consider using a `let` binding to increase its lifetime" ) ;
537
536
self . explain_why_borrow_contains_point ( context, borrow, None , & mut err) ;
538
- err. emit ( ) ;
537
+ err. buffer ( & mut self . errors_buffer ) ;
539
538
}
540
539
541
540
fn report_unscoped_local_value_does_not_live_long_enough (
@@ -563,7 +562,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
563
562
err. span_label ( drop_span, "borrowed value only lives until here" ) ;
564
563
565
564
self . explain_why_borrow_contains_point ( context, borrow, kind_place, & mut err) ;
566
- err. emit ( ) ;
565
+ err. buffer ( & mut self . errors_buffer ) ;
567
566
}
568
567
569
568
fn report_unscoped_temporary_value_does_not_live_long_enough (
@@ -589,7 +588,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
589
588
err. span_label ( drop_span, "temporary value only lives until here" ) ;
590
589
591
590
self . explain_why_borrow_contains_point ( context, borrow, None , & mut err) ;
592
- err. emit ( ) ;
591
+ err. buffer ( & mut self . errors_buffer ) ;
593
592
}
594
593
595
594
pub ( super ) fn report_illegal_mutation_of_borrowed (
@@ -608,7 +607,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
608
607
609
608
self . explain_why_borrow_contains_point ( context, loan, None , & mut err) ;
610
609
611
- err. emit ( ) ;
610
+ err. buffer ( & mut self . errors_buffer ) ;
612
611
}
613
612
614
613
/// Reports an illegal reassignment; for example, an assignment to
@@ -679,7 +678,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
679
678
}
680
679
}
681
680
err. span_label ( span, msg) ;
682
- err. emit ( ) ;
681
+ err. buffer ( & mut self . errors_buffer ) ;
683
682
}
684
683
}
685
684
0 commit comments