From bbd1c3ab73a931bf4823eec836de57e837d2161c Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 12 Aug 2024 15:53:45 +1000 Subject: [PATCH] Streamline some inputs/output traversals. --- compiler/rustc_middle/src/ty/flags.rs | 3 +-- compiler/rustc_middle/src/ty/walk.rs | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_middle/src/ty/flags.rs b/compiler/rustc_middle/src/ty/flags.rs index 1e38e30628a..fc079592583 100644 --- a/compiler/rustc_middle/src/ty/flags.rs +++ b/compiler/rustc_middle/src/ty/flags.rs @@ -251,8 +251,7 @@ fn add_kind(&mut self, kind: &ty::TyKind<'_>) { } &ty::FnPtr(sig_tys, _) => self.bound_computation(sig_tys, |computation, sig_tys| { - computation.add_tys(sig_tys.inputs()); - computation.add_ty(sig_tys.output()); + computation.add_tys(sig_tys.inputs_and_output); }), } } diff --git a/compiler/rustc_middle/src/ty/walk.rs b/compiler/rustc_middle/src/ty/walk.rs index 0a328352e2e..abd6df17514 100644 --- a/compiler/rustc_middle/src/ty/walk.rs +++ b/compiler/rustc_middle/src/ty/walk.rs @@ -189,11 +189,9 @@ fn push_inner<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent: GenericArg<'tcx>) stack.extend(args.iter().rev()); } ty::Tuple(ts) => stack.extend(ts.iter().rev().map(GenericArg::from)), - ty::FnPtr(sig_tys, hdr) => { - let fn_sig = sig_tys.with(hdr); - stack.push(fn_sig.skip_binder().output().into()); + ty::FnPtr(sig_tys, _hdr) => { stack.extend( - fn_sig.skip_binder().inputs().iter().copied().rev().map(|ty| ty.into()), + sig_tys.skip_binder().inputs_and_output.iter().rev().map(|ty| ty.into()), ); } },