Skip to content

Commit c2ecd8f

Browse files
committed
merge self type and substs in trait_method
1 parent a6c5212 commit c2ecd8f

File tree

1 file changed

+4
-5
lines changed
  • compiler/rustc_mir_build/src/build/matches

1 file changed

+4
-5
lines changed

compiler/rustc_mir_build/src/build/matches/test.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
250250
let ref_str_ty = tcx.mk_imm_ref(re_erased, tcx.types.str_);
251251
let ref_str = self.temp(ref_str_ty, test.span);
252252
let deref = tcx.require_lang_item(LangItem::Deref, None);
253-
let method = trait_method(tcx, deref, sym::deref, ty, []);
253+
let method = trait_method(tcx, deref, sym::deref, [ty]);
254254
let eq_block = self.cfg.start_new_block();
255255
self.cfg.push_assign(block, source_info, ref_string, Rvalue::Ref(re_erased, BorrowKind::Shared, place));
256256
self.cfg.terminate(
@@ -445,7 +445,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
445445
};
446446

447447
let eq_def_id = self.tcx.require_lang_item(LangItem::PartialEq, Some(source_info.span));
448-
let method = trait_method(self.tcx, eq_def_id, sym::eq, deref_ty, [deref_ty.into()]);
448+
let method = trait_method(self.tcx, eq_def_id, sym::eq, [deref_ty, deref_ty]);
449449

450450
let bool_ty = self.tcx.types.bool;
451451
let eq_result = self.temp(bool_ty, source_info.span);
@@ -837,10 +837,9 @@ fn trait_method<'tcx>(
837837
tcx: TyCtxt<'tcx>,
838838
trait_def_id: DefId,
839839
method_name: Symbol,
840-
self_ty: Ty<'tcx>,
841-
params: impl IntoIterator<Item = GenericArg<'tcx>, IntoIter: ExactSizeIterator>,
840+
substs: impl IntoIterator<Item = impl Into<GenericArg<'tcx>>>,
842841
) -> ConstantKind<'tcx> {
843-
let substs = tcx.mk_substs_trait(self_ty, params);
842+
let substs = tcx.mk_substs(substs.into_iter().map(Into::into));
844843

845844
// The unhygienic comparison here is acceptable because this is only
846845
// used on known traits.

0 commit comments

Comments
 (0)