merge self type and substs in trait_method
This commit is contained in:
parent
a6c5212f13
commit
c2ecd8f1f6
@ -250,7 +250,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
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(
|
||||
@ -445,7 +445,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
};
|
||||
|
||||
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.into()]);
|
||||
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);
|
||||
@ -837,10 +837,9 @@ fn trait_method<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
trait_def_id: DefId,
|
||||
method_name: Symbol,
|
||||
self_ty: Ty<'tcx>,
|
||||
params: impl IntoIterator<Item = GenericArg<'tcx>, IntoIter: ExactSizeIterator>,
|
||||
substs: impl IntoIterator<Item = impl Into<GenericArg<'tcx>>>,
|
||||
) -> ConstantKind<'tcx> {
|
||||
let substs = tcx.mk_substs_trait(self_ty, params);
|
||||
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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user