Remove many more cases of mk_substs_trait that can now use the iterator scheme`

This commit is contained in:
Oli Scherer 2022-12-13 10:44:35 +00:00
parent 0fe86aa977
commit 1bf80249ae
7 changed files with 25 additions and 19 deletions

View file

@ -336,8 +336,7 @@ impl<'tcx> CloneShimBuilder<'tcx> {
// we must subst the self_ty because it's
// otherwise going to be TySelf and we can't index
// or access fields of a Place of type TySelf.
let substs = tcx.mk_substs_trait(self_ty, []);
let sig = tcx.bound_fn_sig(def_id).subst(tcx, substs);
let sig = tcx.bound_fn_sig(def_id).subst(tcx, &[self_ty.into()]);
let sig = tcx.erase_late_bound_regions(sig);
let span = tcx.def_span(def_id);
@ -573,9 +572,8 @@ fn build_call_shim<'tcx>(
// Create substitutions for the `Self` and `Args` generic parameters of the shim body.
let arg_tup = tcx.mk_tup(untuple_args.iter());
let sig_substs = tcx.mk_substs_trait(ty, [ty::subst::GenericArg::from(arg_tup)]);
(Some(sig_substs), Some(untuple_args))
(Some([ty.into(), arg_tup.into()]), Some(untuple_args))
} else {
(None, None)
};
@ -586,7 +584,7 @@ fn build_call_shim<'tcx>(
assert_eq!(sig_substs.is_some(), !instance.has_polymorphic_mir_body());
let mut sig =
if let Some(sig_substs) = sig_substs { sig.subst(tcx, sig_substs) } else { sig.0 };
if let Some(sig_substs) = sig_substs { sig.subst(tcx, &sig_substs) } else { sig.0 };
if let CallKind::Indirect(fnty) = call_kind {
// `sig` determines our local decls, and thus the callee type in the `Call` terminator. This