Instead of having a separate enum variant for types and consts have one but have either a const
or type.
This commit is contained in:
kadmin 2022-01-07 03:58:32 +00:00
parent 7383a61968
commit 05b8c727d8

View File

@ -645,13 +645,20 @@ pub fn eq_generic_bound(l: &GenericBound, r: &GenericBound) -> bool {
}
}
fn eq_term(l: &Term, r: &Term) -> bool {
match (l, r) {
(Term::Ty(l), Term::Ty(r)) => eq_ty(l,r),
(Term::Const(l), Term::Const(r)) => eq_anon_const(l,r),
_ => false,
}
}
pub fn eq_assoc_constraint(l: &AssocConstraint, r: &AssocConstraint) -> bool {
use AssocConstraintKind::*;
eq_id(l.ident, r.ident)
&& match (&l.kind, &r.kind) {
(Equality { ty: l }, Equality { ty: r }) => eq_ty(l, r),
(Equality { term: l }, Equality { term: r }) => eq_term(l, r),
(Bound { bounds: l }, Bound { bounds: r }) => over(l, r, eq_generic_bound),
(ConstEquality { c: l }, ConstEquality { c: r }) => eq_anon_const(l, r),
_ => false,
}
}