@@ -39,7 +39,7 @@ use rustc_hir::def_id::DefId;
3939use rustc_middle:: ty:: error:: TypeError ;
4040use rustc_middle:: ty:: relate:: { self , Relate , RelateResult , TypeRelation } ;
4141use rustc_middle:: ty:: subst:: SubstsRef ;
42- use rustc_middle:: ty:: { self , InferConst , Ty , TyCtxt } ;
42+ use rustc_middle:: ty:: { self , InferConst , Ty , TyCtxt , TypeFoldable } ;
4343use rustc_middle:: ty:: { IntType , UintType } ;
4444use rustc_span:: { Span , DUMMY_SP } ;
4545
@@ -165,11 +165,19 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
165165 return self . unify_const_variable ( !a_is_expected, vid, a) ;
166166 }
167167 ( 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+ }
169173 return Ok ( b) ;
170174 }
171175 ( _, 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+ }
173181 return Ok ( a) ;
174182 }
175183 _ => { }
0 commit comments