@@ -408,7 +408,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
408
408
self . each_borrow_involving_path (
409
409
context, lvalue_span. 0 , flow_state, |this, _idx, borrow| {
410
410
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 ) ;
412
412
Control :: Break
413
413
} else {
414
414
Control :: Continue
@@ -896,20 +896,28 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
896
896
fn report_use_of_moved ( & mut self ,
897
897
_context : Context ,
898
898
( 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 ( ) ;
903
906
}
904
907
905
908
fn report_move_out_while_borrowed ( & mut self ,
906
909
_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 ( ) ;
913
921
}
914
922
915
923
fn report_use_while_mutably_borrowed ( & mut self ,
0 commit comments