diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-12 21:18:14 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-12 21:18:14 +0000 |
commit | eb931c0d9e0877e573622253ae5b05563841037b (patch) | |
tree | 653ef81450a4d39c5b46f98c97c23fa8586dd7f8 /crates/ra_hir/src/db.rs | |
parent | e56072bfa3e5af69a4c293a38de6e1350ada3573 (diff) | |
parent | 1ed7fbfc1badd2c2a42b4dc2feb1b4bf7835d3ef (diff) |
Merge #505
505: Inherent methods r=matklad a=flodiebold
This adds resolution, type checking and completion for inherent methods.
The main open question here is the caching, I think. I'm not sure whether we should be caching method resolutions in a more fine grained way (currently we just build a hash map of types -> impl blocks, and iterate through all potential impl blocks when looking for a method).
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/db.rs')
-rw-r--r-- | crates/ra_hir/src/db.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index a11c73db0..fd6336dd8 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs | |||
@@ -5,13 +5,13 @@ use ra_db::{SourceRootId, LocationIntener, SyntaxDatabase, Cancelable}; | |||
5 | 5 | ||
6 | use crate::{ | 6 | use crate::{ |
7 | DefLoc, DefId, MacroCallLoc, MacroCallId, Name, HirFileId, | 7 | DefLoc, DefId, MacroCallLoc, MacroCallId, Name, HirFileId, |
8 | SourceFileItems, SourceItemId, | 8 | SourceFileItems, SourceItemId, Crate, |
9 | query_definitions, | 9 | query_definitions, |
10 | FnSignature, FnScopes, | 10 | FnSignature, FnScopes, |
11 | macros::MacroExpansion, | 11 | macros::MacroExpansion, |
12 | module_tree::{ModuleId, ModuleTree}, | 12 | module_tree::{ModuleId, ModuleTree}, |
13 | nameres::{ItemMap, InputModuleItems}, | 13 | nameres::{ItemMap, InputModuleItems}, |
14 | ty::{InferenceResult, Ty}, | 14 | ty::{InferenceResult, Ty, method_resolution::CrateImplBlocks}, |
15 | adt::{StructData, EnumData, EnumVariantData}, | 15 | adt::{StructData, EnumData, EnumVariantData}, |
16 | impl_block::ModuleImplBlocks, | 16 | impl_block::ModuleImplBlocks, |
17 | }; | 17 | }; |
@@ -102,6 +102,11 @@ pub trait HirDatabase: SyntaxDatabase | |||
102 | use fn crate::impl_block::impls_in_module; | 102 | use fn crate::impl_block::impls_in_module; |
103 | } | 103 | } |
104 | 104 | ||
105 | fn impls_in_crate(krate: Crate) -> Cancelable<Arc<CrateImplBlocks>> { | ||
106 | type ImplsInCrateQuery; | ||
107 | use fn crate::ty::method_resolution::CrateImplBlocks::impls_in_crate_query; | ||
108 | } | ||
109 | |||
105 | fn body_hir(def_id: DefId) -> Cancelable<Arc<crate::expr::Body>> { | 110 | fn body_hir(def_id: DefId) -> Cancelable<Arc<crate::expr::Body>> { |
106 | type BodyHirQuery; | 111 | type BodyHirQuery; |
107 | use fn crate::expr::body_hir; | 112 | use fn crate::expr::body_hir; |