@@ -1071,7 +1071,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
1071
1071
// #45983: when trying to assign the contents of an argument to a binding outside of a
1072
1072
// closure, provide a specific message pointing this out.
1073
1073
if let ( & SubregionOrigin :: BindingTypeIsNotValidAtDecl ( ref external_span) ,
1074
- & SubregionOrigin :: Subtype ( TypeTrace { ref cause , .. } ) ,
1074
+ & SubregionOrigin :: Subtype ( _ ) ,
1075
1075
& RegionKind :: ReFree ( ref free_region) ) = ( & sub_origin, & sup_origin, sup_region) {
1076
1076
let hir = & self . tcx . hir ;
1077
1077
if let Some ( node_id) = hir. as_local_node_id ( free_region. scope ) {
@@ -1084,15 +1084,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
1084
1084
let mut err = self . tcx . sess . struct_span_err (
1085
1085
sp,
1086
1086
"borrowed data cannot be moved outside of its closure" ) ;
1087
- let label = match cause. code {
1088
- ObligationCauseCode :: ExprAssignable => {
1089
- "cannot be assigned to binding outside of its closure"
1090
- }
1091
- _ => "cannot be moved outside of its closure" ,
1092
- } ;
1093
- err. span_label ( sp, label) ;
1094
- err. span_label ( * closure_span, "closure you can't escape" ) ;
1095
- err. span_label ( * external_span, "binding declared outside of closure" ) ;
1087
+ err. span_label ( sp, "cannot be moved outside of its closure" ) ;
1088
+ err. span_label ( * external_span,
1089
+ "borrowed data cannot be moved into here..." ) ;
1090
+ err. span_label ( * closure_span,
1091
+ "...because it cannot outlive this closure" ) ;
1096
1092
err. emit ( ) ;
1097
1093
return ;
1098
1094
}
0 commit comments