1
Fork 0

Reduce the amount of passed-around arguments that will get merged into one later anyway

This commit is contained in:
Oli Scherer 2022-11-17 09:03:27 +00:00
parent 1cbc45942d
commit 0c47deed9f
2 changed files with 12 additions and 12 deletions

View file

@ -1,7 +1,5 @@
use crate::ty::subst::SubstsRef;
use crate::ty::{self, Ty, TyCtxt};
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_hir::lang_items::LangItem;
use rustc_macros::HashStable;
use rustc_span::Span;
@ -121,7 +119,8 @@ pub struct OverloadedDeref<'tcx> {
}
impl<'tcx> OverloadedDeref<'tcx> {
pub fn method_call(&self, tcx: TyCtxt<'tcx>, source: Ty<'tcx>) -> (DefId, SubstsRef<'tcx>) {
/// Get the zst function item type for this method call.
pub fn method_call(&self, tcx: TyCtxt<'tcx>, source: Ty<'tcx>) -> Ty<'tcx> {
let trait_def_id = match self.mutbl {
hir::Mutability::Not => tcx.require_lang_item(LangItem::Deref, None),
hir::Mutability::Mut => tcx.require_lang_item(LangItem::DerefMut, None),
@ -132,7 +131,7 @@ impl<'tcx> OverloadedDeref<'tcx> {
.find(|m| m.kind == ty::AssocKind::Fn)
.unwrap()
.def_id;
(method_def_id, tcx.mk_substs_trait(source, &[]))
tcx.mk_fn_def(method_def_id, tcx.mk_substs_trait(source, &[]))
}
}