@@ -1063,18 +1063,17 @@ fn lower_fn_sig_recovering_infer_ret_ty<'tcx>(
10631063 )
10641064}
10651065
1066- /// Convert `ReLateParam`s in `value` back into `ReBound`s so the returned
1067- /// `PolyFnSig` properly binds all late-bound vars.
1066+ /// Convert `ReLateParam`s in `value` back into `ReBound`s and bind it with `bound_vars`.
10681067fn late_param_regions_to_bound < ' tcx , T > (
10691068 tcx : TyCtxt < ' tcx > ,
10701069 scope : DefId ,
10711070 bound_vars : & ' tcx ty:: List < ty:: BoundVariableKind < ' tcx > > ,
10721071 value : T ,
1073- ) -> T
1072+ ) -> ty :: Binder < ' tcx , T >
10741073where
10751074 T : ty:: TypeFoldable < TyCtxt < ' tcx > > ,
10761075{
1077- fold_regions ( tcx, value, |r, debruijn| match r. kind ( ) {
1076+ let value = fold_regions ( tcx, value, |r, debruijn| match r. kind ( ) {
10781077 ty:: ReLateParam ( lp) => {
10791078 // Should be in scope, otherwise inconsistency happens somewhere.
10801079 assert_eq ! ( lp. scope, scope) ;
@@ -1123,7 +1122,9 @@ where
11231122 ty:: Region :: new_bound ( tcx, debruijn, br)
11241123 }
11251124 _ => r,
1126- } )
1125+ } ) ;
1126+
1127+ ty:: Binder :: bind_with_vars ( value, bound_vars)
11271128}
11281129
11291130fn recover_infer_ret_ty < ' tcx > (
@@ -1216,9 +1217,7 @@ fn recover_infer_ret_ty<'tcx>(
12161217 fn_sig. abi ,
12171218 ) ;
12181219
1219- let fn_sig = late_param_regions_to_bound ( tcx, scope, bound_vars, fn_sig) ;
1220-
1221- ty:: Binder :: bind_with_vars ( fn_sig, bound_vars)
1220+ late_param_regions_to_bound ( tcx, scope, bound_vars, fn_sig)
12221221}
12231222
12241223pub fn suggest_impl_trait < ' tcx > (
0 commit comments