@@ -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
@@ -907,12 +907,17 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
907
907
908
908
fn report_move_out_while_borrowed ( & mut self ,
909
909
_context : Context ,
910
- ( lvalue, span) : ( & Lvalue , Span ) ) {
911
- let mut err = self . tcx . cannot_move_when_borrowed (
912
- span, & self . describe_lvalue ( lvalue) , Origin :: Mir ) ;
913
- // FIXME 1: add span_label for "borrow of `()` occurs here"
914
- // FIXME 2: add span_label for "move out of `{}` occurs here"
915
- 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 ( ) ;
916
921
}
917
922
918
923
fn report_use_while_mutably_borrowed ( & mut self ,
0 commit comments