@@ -76,7 +76,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
76
76
// (i.e., if there are no placeholders).
77
77
let next_universe = self . universe ( ) . next_universe ( ) ;
78
78
79
+ let mut region_replaced = false ;
80
+
79
81
let fld_r = |br : ty:: BoundRegion | {
82
+ region_replaced = true ;
80
83
self . tcx . mk_region ( ty:: RePlaceholder ( ty:: PlaceholderRegion {
81
84
universe : next_universe,
82
85
name : br. kind ,
@@ -100,11 +103,12 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
100
103
} )
101
104
} ;
102
105
103
- let ( result, map) = self . tcx . replace_bound_vars ( binder, fld_r, fld_t, fld_c) ;
106
+ let result =
107
+ self . tcx . replace_escaping_bound_vars ( binder. skip_binder ( ) , fld_r, fld_t, fld_c) ;
104
108
105
109
// If there were higher-ranked regions to replace, then actually create
106
110
// the next universe (this avoids needlessly creating universes).
107
- if !map . is_empty ( ) {
111
+ if region_replaced {
108
112
let n_u = self . create_next_universe ( ) ;
109
113
assert_eq ! ( n_u, next_universe) ;
110
114
}
@@ -113,8 +117,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
113
117
"replace_bound_vars_with_placeholders(\
114
118
next_universe={:?}, \
115
119
result={:?}, \
116
- map ={:?})",
117
- next_universe, result, map ,
120
+ region_replaced ={:?})",
121
+ next_universe, result, region_replaced ,
118
122
) ;
119
123
120
124
result
0 commit comments