Remove one more usage of mk_substs_trait

This commit is contained in:
Oli Scherer 2022-12-13 10:49:30 +00:00
parent 1bf80249ae
commit 4ffe3bdf99
3 changed files with 8 additions and 4 deletions

View File

@ -1847,7 +1847,7 @@ impl<'tcx> Operand<'tcx> {
pub fn function_handle(
tcx: TyCtxt<'tcx>,
def_id: DefId,
substs: SubstsRef<'tcx>,
substs: impl IntoIterator<Item = GenericArg<'tcx>>,
span: Span,
) -> Self {
let ty = tcx.mk_fn_def(def_id, substs);

View File

@ -142,7 +142,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let exchange_malloc = Operand::function_handle(
tcx,
tcx.require_lang_item(LangItem::ExchangeMalloc, Some(expr_span)),
ty::List::empty(),
[],
expr_span,
);
let storage = this.temp(tcx.mk_mut_ptr(tcx.types.u8), expr_span);

View File

@ -614,7 +614,6 @@ where
let drop_trait = tcx.require_lang_item(LangItem::Drop, None);
let drop_fn = tcx.associated_item_def_ids(drop_trait)[0];
let ty = self.place_ty(self.place);
let substs = tcx.mk_substs_trait(ty, []);
let ref_ty =
tcx.mk_ref(tcx.lifetimes.re_erased, ty::TypeAndMut { ty, mutbl: hir::Mutability::Mut });
@ -632,7 +631,12 @@ where
)],
terminator: Some(Terminator {
kind: TerminatorKind::Call {
func: Operand::function_handle(tcx, drop_fn, substs, self.source_info.span),
func: Operand::function_handle(
tcx,
drop_fn,
[ty.into()],
self.source_info.span,
),
args: vec![Operand::Move(Place::from(ref_place))],
destination: unit_temp,
target: Some(succ),