diff options
| author | Michael Goulet <michael@errs.io> | 2024-11-03 04:39:08 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-11-04 04:51:31 +0000 |
| commit | e03e9abe3cdccdd1639302f8beafa228d403e076 (patch) | |
| tree | 0f66f879f0cfcf3dcd955a78e7c3b52b672cce17 /compiler/rustc_middle/src/ty | |
| parent | 43c78051ea96f89ecf33533dfed6db6f1eeba150 (diff) | |
| download | rust-e03e9abe3cdccdd1639302f8beafa228d403e076.tar.gz rust-e03e9abe3cdccdd1639302f8beafa228d403e076.zip | |
Register const preds for Deref adjustments in HIR typeck
Diffstat (limited to 'compiler/rustc_middle/src/ty')
| -rw-r--r-- | compiler/rustc_middle/src/ty/adjustment.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_middle/src/ty/adjustment.rs b/compiler/rustc_middle/src/ty/adjustment.rs index ce27e81813c..f8ab555305f 100644 --- a/compiler/rustc_middle/src/ty/adjustment.rs +++ b/compiler/rustc_middle/src/ty/adjustment.rs @@ -1,5 +1,6 @@ use rustc_abi::FieldIdx; use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_hir::lang_items::LangItem; use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable}; use rustc_span::Span; @@ -123,19 +124,18 @@ pub struct OverloadedDeref { } impl OverloadedDeref { - /// Get the zst function item type for this method call. - pub fn method_call<'tcx>(&self, tcx: TyCtxt<'tcx>, source: Ty<'tcx>) -> Ty<'tcx> { + /// Get the [`DefId`] of the method call for the given `Deref`/`DerefMut` trait + /// for this overloaded deref's mutability. + pub fn method_call<'tcx>(&self, tcx: TyCtxt<'tcx>) -> DefId { 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), }; - let method_def_id = tcx - .associated_items(trait_def_id) + tcx.associated_items(trait_def_id) .in_definition_order() .find(|m| m.kind == ty::AssocKind::Fn) .unwrap() - .def_id; - Ty::new_fn_def(tcx, method_def_id, [source]) + .def_id } } |
