match_start_span: Span,
scrutinee_span: Span,
block: BasicBlock,
- place_builder: PlaceBuilder<'tcx>,
+ place_builder: &PlaceBuilder<'tcx>,
test: &Test<'tcx>,
make_target_blocks: impl FnOnce(&mut Self) -> Vec<BasicBlock>,
) {
- let place = place_builder.into_place(self);
+ let place = place_builder.to_place(self);
let place_ty = place.ty(&self.local_decls, self.tcx);
debug!(?place, ?place_ty,);
let ref_str_ty = tcx.mk_imm_ref(re_erased, tcx.types.str_);
let ref_str = self.temp(ref_str_ty, test.span);
let deref = tcx.require_lang_item(LangItem::Deref, None);
- let method = trait_method(tcx, deref, sym::deref, ty, &[]);
+ let method = trait_method(tcx, deref, sym::deref, [ty]);
let eq_block = self.cfg.start_new_block();
self.cfg.push_assign(block, source_info, ref_string, Rvalue::Ref(re_erased, BorrowKind::Shared, place));
self.cfg.terminate(
bug!("non_scalar_compare called on non-reference type: {}", ty);
};
- let eq_def_id = self.tcx.require_lang_item(LangItem::PartialEq, None);
- let method = trait_method(self.tcx, eq_def_id, sym::eq, deref_ty, &[deref_ty.into()]);
+ let eq_def_id = self.tcx.require_lang_item(LangItem::PartialEq, Some(source_info.span));
+ let method = trait_method(self.tcx, eq_def_id, sym::eq, [deref_ty, deref_ty]);
let bool_ty = self.tcx.types.bool;
let eq_result = self.temp(bool_ty, source_info.span);
let downcast_place = match_pair.place.downcast(adt_def, variant_index); // `(x as Variant)`
let consequent_match_pairs = subpatterns.iter().map(|subpattern| {
// e.g., `(x as Variant).0`
- let place = downcast_place.clone().field(subpattern.field, subpattern.pattern.ty);
+ let place = downcast_place
+ .clone_project(PlaceElem::Field(subpattern.field, subpattern.pattern.ty));
// e.g., `(x as Variant).0 @ P1`
MatchPair::new(place, &subpattern.pattern, self)
});
tcx: TyCtxt<'tcx>,
trait_def_id: DefId,
method_name: Symbol,
- self_ty: Ty<'tcx>,
- params: &[GenericArg<'tcx>],
+ substs: impl IntoIterator<Item = impl Into<GenericArg<'tcx>>>,
) -> ConstantKind<'tcx> {
- let substs = tcx.mk_substs_trait(self_ty, params.iter().copied());
+ let substs = tcx.mk_substs(substs.into_iter().map(Into::into));
// The unhygienic comparison here is acceptable because this is only
// used on known traits.
.find(|item| item.kind == ty::AssocKind::Fn)
.expect("trait method not found");
- let method_ty = tcx.bound_type_of(item.def_id);
- let method_ty = method_ty.subst(tcx, substs);
+ let method_ty = tcx.mk_fn_def(item.def_id, substs);
ConstantKind::zero_sized(method_ty)
}