@@ -1013,11 +1013,11 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
1013
1013
}
1014
1014
1015
1015
err_out_of_scope( super_scope, sub_scope, cause) => {
1016
- let ( value_kind, value_msg, is_temporary ) = match err. cmt . cat {
1016
+ let ( value_kind, value_msg) = match err. cmt . cat {
1017
1017
mc:: Categorization :: Rvalue ( _) =>
1018
- ( "temporary value" , "temporary value created here" , true ) ,
1018
+ ( "temporary value" , "temporary value created here" ) ,
1019
1019
_ =>
1020
- ( "borrowed value" , "does not live long enough" , false )
1020
+ ( "borrowed value" , "borrow occurs here" )
1021
1021
} ;
1022
1022
1023
1023
let is_closure = match cause {
@@ -1030,14 +1030,14 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
1030
1030
Some ( primary) => {
1031
1031
db. span = MultiSpan :: from_span ( s) ;
1032
1032
db. span_label ( primary, & format ! ( "capture occurs here" ) ) ;
1033
- db. span_label ( s, & value_msg ) ;
1033
+ db. span_label ( s, & "does not live long enough" ) ;
1034
1034
true
1035
1035
}
1036
1036
None => false
1037
1037
}
1038
1038
}
1039
1039
_ => {
1040
- db. span_label ( error_span, & value_msg ) ;
1040
+ db. span_label ( error_span, & "does not live long enough" ) ;
1041
1041
false
1042
1042
}
1043
1043
} ;
@@ -1047,11 +1047,11 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
1047
1047
1048
1048
match ( sub_span, super_span) {
1049
1049
( Some ( s1) , Some ( s2) ) if s1 == s2 => {
1050
- if !is_temporary && ! is_closure {
1050
+ if !is_closure {
1051
1051
db. span = MultiSpan :: from_span ( s1) ;
1052
- db. span_label ( error_span, & format ! ( "borrow occurs here" ) ) ;
1052
+ db. span_label ( error_span, & value_msg ) ;
1053
1053
let msg = match opt_loan_path ( & err. cmt ) {
1054
- None => "borrowed value" . to_string ( ) ,
1054
+ None => value_kind . to_string ( ) ,
1055
1055
Some ( lp) => {
1056
1056
format ! ( "`{}`" , self . loan_path_to_string( & lp) )
1057
1057
}
@@ -1064,17 +1064,16 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
1064
1064
db. note ( "values in a scope are dropped in the opposite order \
1065
1065
they are created") ;
1066
1066
}
1067
- ( Some ( s1) , Some ( s2) ) if !is_temporary && ! is_closure => {
1067
+ ( Some ( s1) , Some ( s2) ) if !is_closure => {
1068
1068
db. span = MultiSpan :: from_span ( s2) ;
1069
- db. span_label ( error_span, & format ! ( "borrow occurs here" ) ) ;
1069
+ db. span_label ( error_span, & value_msg ) ;
1070
1070
let msg = match opt_loan_path ( & err. cmt ) {
1071
- None => "borrowed value" . to_string ( ) ,
1071
+ None => value_kind . to_string ( ) ,
1072
1072
Some ( lp) => {
1073
1073
format ! ( "`{}`" , self . loan_path_to_string( & lp) )
1074
1074
}
1075
1075
} ;
1076
- db. span_label ( s2,
1077
- & format ! ( "{} dropped here while still borrowed" , msg) ) ;
1076
+ db. span_label ( s2, & format ! ( "{} dropped here while still borrowed" , msg) ) ;
1078
1077
db. span_label ( s1, & format ! ( "{} needs to live until here" , value_kind) ) ;
1079
1078
}
1080
1079
_ => {
0 commit comments