1
Fork 0

Inline and remove generic_args_may_unify.

It has a single callsite.
This commit is contained in:
Nicholas Nethercote 2023-03-07 16:02:01 +11:00
parent 47225e8700
commit 9fa69473fd

View file

@ -193,16 +193,8 @@ impl DeepRejectCtxt {
obligation_substs: SubstsRef<'tcx>, obligation_substs: SubstsRef<'tcx>,
impl_substs: SubstsRef<'tcx>, impl_substs: SubstsRef<'tcx>,
) -> bool { ) -> bool {
iter::zip(obligation_substs, impl_substs) iter::zip(obligation_substs, impl_substs).all(|(obl, imp)| {
.all(|(obl, imp)| self.generic_args_may_unify(obl, imp)) match (obl.unpack(), imp.unpack()) {
}
pub fn generic_args_may_unify<'tcx>(
self,
obligation_arg: ty::GenericArg<'tcx>,
impl_arg: ty::GenericArg<'tcx>,
) -> bool {
match (obligation_arg.unpack(), impl_arg.unpack()) {
// We don't fast reject based on regions for now. // We don't fast reject based on regions for now.
(GenericArgKind::Lifetime(_), GenericArgKind::Lifetime(_)) => true, (GenericArgKind::Lifetime(_), GenericArgKind::Lifetime(_)) => true,
(GenericArgKind::Type(obl), GenericArgKind::Type(imp)) => { (GenericArgKind::Type(obl), GenericArgKind::Type(imp)) => {
@ -211,8 +203,9 @@ impl DeepRejectCtxt {
(GenericArgKind::Const(obl), GenericArgKind::Const(imp)) => { (GenericArgKind::Const(obl), GenericArgKind::Const(imp)) => {
self.consts_may_unify(obl, imp) self.consts_may_unify(obl, imp)
} }
_ => bug!("kind mismatch: {obligation_arg} {impl_arg}"), _ => bug!("kind mismatch: {obl} {imp}"),
} }
})
} }
pub fn types_may_unify<'tcx>(self, obligation_ty: Ty<'tcx>, impl_ty: Ty<'tcx>) -> bool { pub fn types_may_unify<'tcx>(self, obligation_ty: Ty<'tcx>, impl_ty: Ty<'tcx>) -> bool {