]> git.lizzy.rs Git - rust.git/blobdiff - crates/hir/src/semantics.rs
Auto merge of #12800 - hi-rustin:rustin-patch-issue-12717, r=hi-rustin
[rust.git] / crates / hir / src / semantics.rs
index 2574adb35a53a87b800a081fce8aebc20a67199d..744f3865aaa4c277ee18915d5d260f6b2ea7d075 100644 (file)
@@ -16,7 +16,6 @@
     name::{known, AsName},
     ExpansionInfo, MacroCallId,
 };
-use hir_ty::Interner;
 use itertools::Itertools;
 use rustc_hash::{FxHashMap, FxHashSet};
 use smallvec::{smallvec, SmallVec};
@@ -348,9 +347,6 @@ pub fn resolve_method_call(&self, call: &ast::MethodCallExpr) -> Option<Function
         self.imp.resolve_method_call(call).map(Function::from)
     }
 
-    pub fn resolve_impl_method(&self, call: &ast::Expr) -> Option<Function> {
-        self.imp.resolve_impl_method(call).map(Function::from)
-    }
     pub fn resolve_method_call_as_callable(&self, call: &ast::MethodCallExpr) -> Option<Callable> {
         self.imp.resolve_method_call_as_callable(call)
     }
@@ -978,22 +974,11 @@ fn binding_mode_of_pat(&self, pat: &ast::IdentPat) -> Option<BindingMode> {
     }
 
     fn resolve_method_call(&self, call: &ast::MethodCallExpr) -> Option<FunctionId> {
-        self.analyze(call.syntax())?.resolve_method_call(self.db, call).map(|(id, _)| id)
-    }
-
-    fn resolve_impl_method(&self, call: &ast::Expr) -> Option<FunctionId> {
-        self.analyze(call.syntax())?.resolve_impl_method(self.db, call)
+        self.analyze(call.syntax())?.resolve_method_call(self.db, call)
     }
 
     fn resolve_method_call_as_callable(&self, call: &ast::MethodCallExpr) -> Option<Callable> {
-        let source_analyzer = self.analyze(call.syntax())?;
-        let (func, subst) = source_analyzer.resolve_method_call(self.db, call)?;
-        let ty = self.db.value_ty(func.into()).substitute(Interner, &subst);
-        let resolver = source_analyzer.resolver;
-        let ty = Type::new_with_resolver(self.db, &resolver, ty);
-        let mut res = ty.as_callable(self.db)?;
-        res.is_bound_method = true;
-        Some(res)
+        self.analyze(call.syntax())?.resolve_method_call_as_callable(self.db, call)
     }
 
     fn resolve_field(&self, field: &ast::FieldExpr) -> Option<Field> {