mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-22 18:15:07 +03:00
correctly handle escaping bound variables
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
use rustc_middle::ty::error::TypeError;
|
||||
use rustc_middle::ty::relate::{self, Relate, RelateResult, TypeRelation};
|
||||
use rustc_middle::ty::subst::SubstsRef;
|
||||
use rustc_middle::ty::{self, InferConst, Ty, TyCtxt};
|
||||
use rustc_middle::ty::{self, InferConst, Ty, TyCtxt, TypeFoldable};
|
||||
use rustc_middle::ty::{IntType, UintType};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
||||
@@ -165,11 +165,19 @@ pub fn super_combine_consts<R>(
|
||||
return self.unify_const_variable(!a_is_expected, vid, a);
|
||||
}
|
||||
(ty::ConstKind::Unevaluated(..), _) if self.tcx.features().const_generics => {
|
||||
relation.const_equate_obligation(a, b);
|
||||
// FIXME(#59490): Need to remove the leak check to accomodate
|
||||
// escaping bound variables here.
|
||||
if !a.has_escaping_bound_vars() && !b.has_escaping_bound_vars() {
|
||||
relation.const_equate_obligation(a, b);
|
||||
}
|
||||
return Ok(b);
|
||||
}
|
||||
(_, ty::ConstKind::Unevaluated(..)) if self.tcx.features().const_generics => {
|
||||
relation.const_equate_obligation(a, b);
|
||||
// FIXME(#59490): Need to remove the leak check to accomodate
|
||||
// escaping bound variables here.
|
||||
if !a.has_escaping_bound_vars() && !b.has_escaping_bound_vars() {
|
||||
relation.const_equate_obligation(a, b);
|
||||
}
|
||||
return Ok(a);
|
||||
}
|
||||
_ => {}
|
||||
|
||||
Reference in New Issue
Block a user