Rename super_relate_* to structurally_relate_*
This commit is contained in:
parent
6d0b6c0d2c
commit
41501c7449
@ -145,7 +145,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||||||
Ok(a)
|
Ok(a)
|
||||||
}
|
}
|
||||||
|
|
||||||
_ => ty::relate::super_relate_tys(relation, a, b),
|
_ => ty::relate::structurally_relate_tys(relation, a, b),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
ty::relate::super_relate_consts(relation, a, b)
|
ty::relate::structurally_relate_consts(relation, a, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Unifies the const variable `target_vid` with the given constant.
|
/// Unifies the const variable `target_vid` with the given constant.
|
||||||
|
@ -2723,7 +2723,7 @@ impl<'tcx> TypeRelation<'tcx> for SameTypeModuloInfer<'_, 'tcx> {
|
|||||||
| (ty::Infer(ty::InferTy::TyVar(_)), _)
|
| (ty::Infer(ty::InferTy::TyVar(_)), _)
|
||||||
| (_, ty::Infer(ty::InferTy::TyVar(_))) => Ok(a),
|
| (_, ty::Infer(ty::InferTy::TyVar(_))) => Ok(a),
|
||||||
(ty::Infer(_), _) | (_, ty::Infer(_)) => Err(TypeError::Mismatch),
|
(ty::Infer(_), _) | (_, ty::Infer(_)) => Err(TypeError::Mismatch),
|
||||||
_ => relate::super_relate_tys(self, a, b),
|
_ => relate::structurally_relate_tys(self, a, b),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_ => relate::super_relate_tys(self, t, t),
|
_ => relate::structurally_relate_tys(self, t, t),
|
||||||
}?;
|
}?;
|
||||||
|
|
||||||
self.cache.insert(t, g);
|
self.cache.insert(t, g);
|
||||||
@ -422,7 +422,7 @@ where
|
|||||||
Err(TypeError::Mismatch)
|
Err(TypeError::Mismatch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => relate::super_relate_consts(self, c, c),
|
_ => relate::structurally_relate_consts(self, c, c),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ impl<'tcx> TypeRelation<'tcx> for Match<'tcx> {
|
|||||||
} else if pattern == value {
|
} else if pattern == value {
|
||||||
Ok(pattern)
|
Ok(pattern)
|
||||||
} else {
|
} else {
|
||||||
relate::super_relate_tys(self, pattern, value)
|
relate::structurally_relate_tys(self, pattern, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ impl<'tcx> TypeRelation<'tcx> for Match<'tcx> {
|
|||||||
if pattern == value {
|
if pattern == value {
|
||||||
Ok(pattern)
|
Ok(pattern)
|
||||||
} else {
|
} else {
|
||||||
relate::super_relate_consts(self, pattern, value)
|
relate::structurally_relate_consts(self, pattern, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ impl<'tcx> TypeRelation<'tcx> for Match<'tcx> {
|
|||||||
|
|
||||||
(&ty::Error(guar), _) | (_, &ty::Error(guar)) => Ok(self.tcx().ty_error(guar)),
|
(&ty::Error(guar), _) | (_, &ty::Error(guar)) => Ok(self.tcx().ty_error(guar)),
|
||||||
|
|
||||||
_ => relate::super_relate_tys(self, a, b),
|
_ => relate::structurally_relate_tys(self, a, b),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ impl<'tcx> TypeRelation<'tcx> for Match<'tcx> {
|
|||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
relate::super_relate_consts(self, a, b)
|
relate::structurally_relate_consts(self, a, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn binders<T>(
|
fn binders<T>(
|
||||||
|
@ -388,24 +388,24 @@ impl<'tcx> Relate<'tcx> for Ty<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The main "type relation" routine. Note that this does not handle
|
/// Relates `a` and `b` structurally, calling the relation for all nested values.
|
||||||
/// inference artifacts, so you should filter those out before calling
|
/// Any semantic equality, e.g. of projections, and inference variables have to be
|
||||||
/// it.
|
/// handled by the caller.
|
||||||
pub fn super_relate_tys<'tcx, R: TypeRelation<'tcx>>(
|
pub fn structurally_relate_tys<'tcx, R: TypeRelation<'tcx>>(
|
||||||
relation: &mut R,
|
relation: &mut R,
|
||||||
a: Ty<'tcx>,
|
a: Ty<'tcx>,
|
||||||
b: Ty<'tcx>,
|
b: Ty<'tcx>,
|
||||||
) -> RelateResult<'tcx, Ty<'tcx>> {
|
) -> RelateResult<'tcx, Ty<'tcx>> {
|
||||||
let tcx = relation.tcx();
|
let tcx = relation.tcx();
|
||||||
debug!("super_relate_tys: a={:?} b={:?}", a, b);
|
debug!("structurally_relate_tys: a={:?} b={:?}", a, b);
|
||||||
match (a.kind(), b.kind()) {
|
match (a.kind(), b.kind()) {
|
||||||
(&ty::Infer(_), _) | (_, &ty::Infer(_)) => {
|
(&ty::Infer(_), _) | (_, &ty::Infer(_)) => {
|
||||||
// The caller should handle these cases!
|
// The caller should handle these cases!
|
||||||
bug!("var types encountered in super_relate_tys")
|
bug!("var types encountered in structurally_relate_tys")
|
||||||
}
|
}
|
||||||
|
|
||||||
(ty::Bound(..), _) | (_, ty::Bound(..)) => {
|
(ty::Bound(..), _) | (_, ty::Bound(..)) => {
|
||||||
bug!("bound types encountered in super_relate_tys")
|
bug!("bound types encountered in structurally_relate_tys")
|
||||||
}
|
}
|
||||||
|
|
||||||
(&ty::Error(guar), _) | (_, &ty::Error(guar)) => Ok(tcx.ty_error(guar)),
|
(&ty::Error(guar), _) | (_, &ty::Error(guar)) => Ok(tcx.ty_error(guar)),
|
||||||
@ -575,15 +575,18 @@ pub fn super_relate_tys<'tcx, R: TypeRelation<'tcx>>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The main "const relation" routine. Note that this does not handle
|
/// Relates `a` and `b` structurally, calling the relation for all nested values.
|
||||||
/// inference artifacts, so you should filter those out before calling
|
/// Any semantic equality, e.g. of unevaluated consts, and inference variables have
|
||||||
/// it.
|
/// to be handled by the caller.
|
||||||
pub fn super_relate_consts<'tcx, R: TypeRelation<'tcx>>(
|
///
|
||||||
|
/// FIXME: This is not totally structual, which probably should be fixed.
|
||||||
|
/// See the HACKs below.
|
||||||
|
pub fn structurally_relate_consts<'tcx, R: TypeRelation<'tcx>>(
|
||||||
relation: &mut R,
|
relation: &mut R,
|
||||||
mut a: ty::Const<'tcx>,
|
mut a: ty::Const<'tcx>,
|
||||||
mut b: ty::Const<'tcx>,
|
mut b: ty::Const<'tcx>,
|
||||||
) -> RelateResult<'tcx, ty::Const<'tcx>> {
|
) -> RelateResult<'tcx, ty::Const<'tcx>> {
|
||||||
debug!("{}.super_relate_consts(a = {:?}, b = {:?})", relation.tag(), a, b);
|
debug!("{}.structurally_relate_consts(a = {:?}, b = {:?})", relation.tag(), a, b);
|
||||||
let tcx = relation.tcx();
|
let tcx = relation.tcx();
|
||||||
|
|
||||||
// HACK(const_generics): We still need to eagerly evaluate consts when
|
// HACK(const_generics): We still need to eagerly evaluate consts when
|
||||||
@ -602,7 +605,7 @@ pub fn super_relate_consts<'tcx, R: TypeRelation<'tcx>>(
|
|||||||
b = tcx.expand_abstract_consts(b);
|
b = tcx.expand_abstract_consts(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("{}.super_relate_consts(normed_a = {:?}, normed_b = {:?})", relation.tag(), a, b);
|
debug!("{}.structurally_relate_consts(normed_a = {:?}, normed_b = {:?})", relation.tag(), a, b);
|
||||||
|
|
||||||
// Currently, the values that can be unified are primitive types,
|
// Currently, the values that can be unified are primitive types,
|
||||||
// and those that derive both `PartialEq` and `Eq`, corresponding
|
// and those that derive both `PartialEq` and `Eq`, corresponding
|
||||||
@ -610,7 +613,7 @@ pub fn super_relate_consts<'tcx, R: TypeRelation<'tcx>>(
|
|||||||
let is_match = match (a.kind(), b.kind()) {
|
let is_match = match (a.kind(), b.kind()) {
|
||||||
(ty::ConstKind::Infer(_), _) | (_, ty::ConstKind::Infer(_)) => {
|
(ty::ConstKind::Infer(_), _) | (_, ty::ConstKind::Infer(_)) => {
|
||||||
// The caller should handle these cases!
|
// The caller should handle these cases!
|
||||||
bug!("var types encountered in super_relate_consts: {:?} {:?}", a, b)
|
bug!("var types encountered in structurally_relate_consts: {:?} {:?}", a, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
(ty::ConstKind::Error(_), _) => return Ok(a),
|
(ty::ConstKind::Error(_), _) => return Ok(a),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user