Streamline some inputs/output traversals.

This commit is contained in:
Nicholas Nethercote 2024-08-12 15:53:45 +10:00
parent b9f3db6adb
commit bbd1c3ab73
2 changed files with 3 additions and 6 deletions

View File

@ -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);
}),
}
}

View File

@ -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()),
);
}
},