diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-03-07 16:02:01 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-03-29 06:48:52 +1100 |
| commit | 9fa69473fd34d9d8974ebe722e21fd6feae6c986 (patch) | |
| tree | 2590a9913554417f6faa67aab6e8fd7ca2e176be | |
| parent | 47225e8700d8e10848b4f8df8e551fc7e438240f (diff) | |
| download | rust-9fa69473fd34d9d8974ebe722e21fd6feae6c986.tar.gz rust-9fa69473fd34d9d8974ebe722e21fd6feae6c986.zip | |
Inline and remove `generic_args_may_unify`.
It has a single callsite.
| -rw-r--r-- | compiler/rustc_middle/src/ty/fast_reject.rs | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/compiler/rustc_middle/src/ty/fast_reject.rs b/compiler/rustc_middle/src/ty/fast_reject.rs index 6fe91b0cfa0..0a6e94248e6 100644 --- a/compiler/rustc_middle/src/ty/fast_reject.rs +++ b/compiler/rustc_middle/src/ty/fast_reject.rs @@ -193,26 +193,19 @@ impl DeepRejectCtxt { obligation_substs: SubstsRef<'tcx>, impl_substs: SubstsRef<'tcx>, ) -> bool { - iter::zip(obligation_substs, impl_substs) - .all(|(obl, imp)| self.generic_args_may_unify(obl, imp)) - } - - 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. - (GenericArgKind::Lifetime(_), GenericArgKind::Lifetime(_)) => true, - (GenericArgKind::Type(obl), GenericArgKind::Type(imp)) => { - self.types_may_unify(obl, imp) - } - (GenericArgKind::Const(obl), GenericArgKind::Const(imp)) => { - self.consts_may_unify(obl, imp) + iter::zip(obligation_substs, impl_substs).all(|(obl, imp)| { + match (obl.unpack(), imp.unpack()) { + // We don't fast reject based on regions for now. + (GenericArgKind::Lifetime(_), GenericArgKind::Lifetime(_)) => true, + (GenericArgKind::Type(obl), GenericArgKind::Type(imp)) => { + self.types_may_unify(obl, imp) + } + (GenericArgKind::Const(obl), GenericArgKind::Const(imp)) => { + self.consts_may_unify(obl, imp) + } + _ => bug!("kind mismatch: {obl} {imp}"), } - _ => bug!("kind mismatch: {obligation_arg} {impl_arg}"), - } + }) } pub fn types_may_unify<'tcx>(self, obligation_ty: Ty<'tcx>, impl_ty: Ty<'tcx>) -> bool { |
