@@ -39,7 +39,7 @@ use rustc_hir::def_id::DefId;
39
39
use rustc_middle:: ty:: error:: TypeError ;
40
40
use rustc_middle:: ty:: relate:: { self , Relate , RelateResult , TypeRelation } ;
41
41
use rustc_middle:: ty:: subst:: SubstsRef ;
42
- use rustc_middle:: ty:: { self , InferConst , Ty , TyCtxt } ;
42
+ use rustc_middle:: ty:: { self , InferConst , Ty , TyCtxt , TypeFoldable } ;
43
43
use rustc_middle:: ty:: { IntType , UintType } ;
44
44
use rustc_span:: { Span , DUMMY_SP } ;
45
45
@@ -165,11 +165,19 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
165
165
return self . unify_const_variable ( !a_is_expected, vid, a) ;
166
166
}
167
167
( ty:: ConstKind :: Unevaluated ( ..) , _) if self . tcx . features ( ) . const_generics => {
168
- relation. const_equate_obligation ( a, b) ;
168
+ // FIXME(#59490): Need to remove the leak check to accomodate
169
+ // escaping bound variables here.
170
+ if !a. has_escaping_bound_vars ( ) && !b. has_escaping_bound_vars ( ) {
171
+ relation. const_equate_obligation ( a, b) ;
172
+ }
169
173
return Ok ( b) ;
170
174
}
171
175
( _, ty:: ConstKind :: Unevaluated ( ..) ) if self . tcx . features ( ) . const_generics => {
172
- relation. const_equate_obligation ( a, b) ;
176
+ // FIXME(#59490): Need to remove the leak check to accomodate
177
+ // escaping bound variables here.
178
+ if !a. has_escaping_bound_vars ( ) && !b. has_escaping_bound_vars ( ) {
179
+ relation. const_equate_obligation ( a, b) ;
180
+ }
173
181
return Ok ( a) ;
174
182
}
175
183
_ => { }
0 commit comments