@@ -408,7 +408,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
408408 self . each_borrow_involving_path (
409409 context, lvalue_span. 0 , flow_state, |this, _idx, borrow| {
410410 if !borrow. compatible_with ( BorrowKind :: Mut ) {
411- this. report_move_out_while_borrowed ( context, lvalue_span) ;
411+ this. report_move_out_while_borrowed ( context, lvalue_span, borrow ) ;
412412 Control :: Break
413413 } else {
414414 Control :: Continue
@@ -896,20 +896,28 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
896896 fn report_use_of_moved ( & mut self ,
897897 _context : Context ,
898898 ( lvalue, span) : ( & Lvalue , Span ) ) {
899- let mut err = self . tcx . cannot_act_on_uninitialized_variable (
900- span, "use" , & self . describe_lvalue ( lvalue) , Origin :: Mir ) ;
901- // FIXME: add span_label for use of uninitialized variable
902- err. emit ( ) ;
899+ self . tcx . cannot_act_on_uninitialized_variable ( span,
900+ "use" ,
901+ & self . describe_lvalue ( lvalue) ,
902+ Origin :: Mir )
903+ . span_label ( span, format ! ( "use of possibly uninitialized `{}`" ,
904+ self . describe_lvalue( lvalue) ) )
905+ . emit ( ) ;
903906 }
904907
905908 fn report_move_out_while_borrowed ( & mut self ,
906909 _context : Context ,
907- ( lvalue, span) : ( & Lvalue , Span ) ) {
908- let mut err = self . tcx . cannot_move_when_borrowed (
909- span, & self . describe_lvalue ( lvalue) , Origin :: Mir ) ;
910- // FIXME 1: add span_label for "borrow of `()` occurs here"
911- // FIXME 2: add span_label for "move out of `{}` occurs here"
912- err. emit ( ) ;
910+ ( lvalue, span) : ( & Lvalue , Span ) ,
911+ borrow : & BorrowData ) {
912+ self . tcx . cannot_move_when_borrowed ( span,
913+ & self . describe_lvalue ( lvalue) ,
914+ Origin :: Mir )
915+ . span_label ( self . retrieve_borrow_span ( borrow) ,
916+ format ! ( "borrow of `{}` occurs here" ,
917+ self . describe_lvalue( & borrow. lvalue) ) )
918+ . span_label ( span, format ! ( "move out of `{}` occurs here" ,
919+ self . describe_lvalue( lvalue) ) )
920+ . emit ( ) ;
913921 }
914922
915923 fn report_use_while_mutably_borrowed ( & mut self ,
0 commit comments