@@ -919,11 +919,9 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
919
919
}
920
920
921
921
let mut db = self . path_does_not_live_long_enough ( error_span, & msg, Origin :: Ast ) ;
922
- let ( value_kind, value_msg) = match err. cmt . cat {
923
- mc:: Categorization :: Rvalue ( ..) =>
924
- ( "temporary value" , "temporary value created here" ) ,
925
- _ =>
926
- ( "borrowed value" , "borrow occurs here" )
922
+ let value_kind = match err. cmt . cat {
923
+ mc:: Categorization :: Rvalue ( ..) => "temporary value" ,
924
+ _ => "borrowed value" ,
927
925
} ;
928
926
929
927
let is_closure = match cause {
@@ -936,14 +934,16 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
936
934
Some ( primary) => {
937
935
db. span = MultiSpan :: from_span ( s) ;
938
936
db. span_label ( primary, "capture occurs here" ) ;
939
- db. span_label ( s, "does not live long enough" ) ;
937
+ db. span_label ( s, format ! ( "{} does not live long enough" ,
938
+ value_kind) ) ;
940
939
true
941
940
}
942
941
None => false
943
942
}
944
943
}
945
944
_ => {
946
- db. span_label ( error_span, "does not live long enough" ) ;
945
+ db. span_label ( error_span, format ! ( "{} does not live long enough" ,
946
+ value_kind) ) ;
947
947
false
948
948
}
949
949
} ;
@@ -954,8 +954,6 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
954
954
match ( sub_span, super_span) {
955
955
( Some ( s1) , Some ( s2) ) if s1 == s2 => {
956
956
if !is_closure {
957
- db. span = MultiSpan :: from_span ( s1) ;
958
- db. span_label ( error_span, value_msg) ;
959
957
let msg = match opt_loan_path ( & err. cmt ) {
960
958
None => value_kind. to_string ( ) ,
961
959
Some ( lp) => {
@@ -971,8 +969,6 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
971
969
they are created") ;
972
970
}
973
971
( Some ( s1) , Some ( s2) ) if !is_closure => {
974
- db. span = MultiSpan :: from_span ( s2) ;
975
- db. span_label ( error_span, value_msg) ;
976
972
let msg = match opt_loan_path ( & err. cmt ) {
977
973
None => value_kind. to_string ( ) ,
978
974
Some ( lp) => {
0 commit comments