@@ -58,17 +58,17 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
5858 Some ( name) => format ! ( "`{}`" , name) ,
5959 None => "value" . to_owned ( ) ,
6060 } ;
61- self . tcx
61+ let mut err = self . tcx
6262 . cannot_act_on_uninitialized_variable (
6363 span,
6464 desired_action. as_noun ( ) ,
6565 & self
6666 . describe_place_with_options ( place, IncludingDowncast ( true ) )
6767 . unwrap_or ( "_" . to_owned ( ) ) ,
6868 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 ) ;
7272 } else {
7373 let msg = "" ; //FIXME: add "partially " or "collaterally "
7474
@@ -143,7 +143,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
143143 }
144144 }
145145
146- err. emit ( ) ;
146+ err. buffer ( & mut self . errors_buffer ) ;
147147 }
148148 }
149149
@@ -173,7 +173,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
173173 ) ;
174174 err. span_label ( span, format ! ( "move out of {} occurs here" , value_msg) ) ;
175175 self . explain_why_borrow_contains_point ( context, borrow, None , & mut err) ;
176- err. emit ( ) ;
176+ err. buffer ( & mut self . errors_buffer ) ;
177177 }
178178
179179 pub ( super ) fn report_use_while_mutably_borrowed (
@@ -194,8 +194,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
194194 ) ;
195195
196196 self . explain_why_borrow_contains_point ( context, borrow, None , & mut err) ;
197-
198- err. emit ( ) ;
197+ err. buffer ( & mut self . errors_buffer ) ;
199198 }
200199
201200 /// 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> {
391390
392391 self . explain_why_borrow_contains_point ( context, issued_borrow, None , & mut err) ;
393392
394- err. emit ( ) ;
393+ err. buffer ( & mut self . errors_buffer ) ;
395394 }
396395
397396 pub ( super ) fn report_borrowed_value_does_not_live_long_enough (
@@ -513,7 +512,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
513512 format ! ( "`{}` dropped here while still borrowed" , name) ,
514513 ) ;
515514 self . explain_why_borrow_contains_point ( context, borrow, None , & mut err) ;
516- err. emit ( ) ;
515+ err. buffer ( & mut self . errors_buffer ) ;
517516 }
518517
519518 fn report_scoped_temporary_value_does_not_live_long_enough (
@@ -535,7 +534,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
535534 ) ;
536535 err. note ( "consider using a `let` binding to increase its lifetime" ) ;
537536 self . explain_why_borrow_contains_point ( context, borrow, None , & mut err) ;
538- err. emit ( ) ;
537+ err. buffer ( & mut self . errors_buffer ) ;
539538 }
540539
541540 fn report_unscoped_local_value_does_not_live_long_enough (
@@ -563,7 +562,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
563562 err. span_label ( drop_span, "borrowed value only lives until here" ) ;
564563
565564 self . explain_why_borrow_contains_point ( context, borrow, kind_place, & mut err) ;
566- err. emit ( ) ;
565+ err. buffer ( & mut self . errors_buffer ) ;
567566 }
568567
569568 fn report_unscoped_temporary_value_does_not_live_long_enough (
@@ -589,7 +588,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
589588 err. span_label ( drop_span, "temporary value only lives until here" ) ;
590589
591590 self . explain_why_borrow_contains_point ( context, borrow, None , & mut err) ;
592- err. emit ( ) ;
591+ err. buffer ( & mut self . errors_buffer ) ;
593592 }
594593
595594 pub ( super ) fn report_illegal_mutation_of_borrowed (
@@ -608,7 +607,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
608607
609608 self . explain_why_borrow_contains_point ( context, loan, None , & mut err) ;
610609
611- err. emit ( ) ;
610+ err. buffer ( & mut self . errors_buffer ) ;
612611 }
613612
614613 /// Reports an illegal reassignment; for example, an assignment to
@@ -679,7 +678,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
679678 }
680679 }
681680 err. span_label ( span, msg) ;
682- err. emit ( ) ;
681+ err. buffer ( & mut self . errors_buffer ) ;
683682 }
684683}
685684
0 commit comments