diff options
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/code_model_impl/module.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/ids.rs | 5 | ||||
-rw-r--r-- | crates/ra_hir/src/lib.rs | 1 | ||||
-rw-r--r-- | crates/ra_hir/src/nameres/tests.rs | 13 |
4 files changed, 13 insertions, 9 deletions
diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs index 0d22c9dbe..56e14fac1 100644 --- a/crates/ra_hir/src/code_model_impl/module.rs +++ b/crates/ra_hir/src/code_model_impl/module.rs | |||
@@ -3,7 +3,8 @@ use ra_syntax::{ast, SyntaxNode, AstNode, TreePtr}; | |||
3 | 3 | ||
4 | use crate::{ | 4 | use crate::{ |
5 | Module, ModuleSource, Problem, | 5 | Module, ModuleSource, Problem, |
6 | Crate, DefId, DefLoc, DefKind, Name, Path, PathKind, PerNs, Def, ModuleId, | 6 | Crate, DefId, DefLoc, DefKind, Name, Path, PathKind, PerNs, Def, |
7 | module_tree::ModuleId, | ||
7 | nameres::ModuleScope, | 8 | nameres::ModuleScope, |
8 | db::HirDatabase, | 9 | db::HirDatabase, |
9 | }; | 10 | }; |
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs index 624ab808f..3db757778 100644 --- a/crates/ra_hir/src/ids.rs +++ b/crates/ra_hir/src/ids.rs | |||
@@ -2,7 +2,10 @@ use ra_db::{SourceRootId, LocationIntener, Cancelable, FileId}; | |||
2 | use ra_syntax::{TreePtr, SyntaxKind, SyntaxNode, SourceFile, AstNode, ast}; | 2 | use ra_syntax::{TreePtr, SyntaxKind, SyntaxNode, SourceFile, AstNode, ast}; |
3 | use ra_arena::{Arena, RawId, impl_arena_id}; | 3 | use ra_arena::{Arena, RawId, impl_arena_id}; |
4 | 4 | ||
5 | use crate::{HirDatabase, PerNs, ModuleId, Def, Function, Struct, Enum, ImplBlock, Crate}; | 5 | use crate::{ |
6 | HirDatabase, PerNs, Def, Function, Struct, Enum, ImplBlock, Crate, | ||
7 | module_tree::ModuleId, | ||
8 | }; | ||
6 | 9 | ||
7 | use crate::code_model_api::Module; | 10 | use crate::code_model_api::Module; |
8 | 11 | ||
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index cd04575d1..f8ac28cf7 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs | |||
@@ -47,7 +47,6 @@ pub use self::{ | |||
47 | name::Name, | 47 | name::Name, |
48 | ids::{HirFileId, DefId, DefLoc, MacroCallId, MacroCallLoc}, | 48 | ids::{HirFileId, DefId, DefLoc, MacroCallId, MacroCallLoc}, |
49 | macros::{MacroDef, MacroInput, MacroExpansion}, | 49 | macros::{MacroDef, MacroInput, MacroExpansion}, |
50 | module_tree::ModuleId, | ||
51 | nameres::{ItemMap, PerNs, Namespace, Resolution}, | 50 | nameres::{ItemMap, PerNs, Namespace, Resolution}, |
52 | function::{Function, FnSignature, FnScopes, ScopesWithSyntaxMapping}, | 51 | function::{Function, FnSignature, FnScopes, ScopesWithSyntaxMapping}, |
53 | ty::Ty, | 52 | ty::Ty, |
diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs index 04faec4fb..82222d1ad 100644 --- a/crates/ra_hir/src/nameres/tests.rs +++ b/crates/ra_hir/src/nameres/tests.rs | |||
@@ -6,22 +6,23 @@ use relative_path::RelativePath; | |||
6 | use test_utils::assert_eq_text; | 6 | use test_utils::assert_eq_text; |
7 | 7 | ||
8 | use crate::{ | 8 | use crate::{ |
9 | self as hir, | 9 | ItemMap, Resolution, |
10 | db::HirDatabase, | 10 | db::HirDatabase, |
11 | mock::MockDatabase, | 11 | mock::MockDatabase, |
12 | module_tree::ModuleId, | ||
12 | }; | 13 | }; |
13 | 14 | ||
14 | fn item_map(fixture: &str) -> (Arc<hir::ItemMap>, hir::ModuleId) { | 15 | fn item_map(fixture: &str) -> (Arc<ItemMap>, ModuleId) { |
15 | let (db, pos) = MockDatabase::with_position(fixture); | 16 | let (db, pos) = MockDatabase::with_position(fixture); |
16 | let source_root = db.file_source_root(pos.file_id); | 17 | let source_root = db.file_source_root(pos.file_id); |
17 | let module = hir::source_binder::module_from_position(&db, pos) | 18 | let module = crate::source_binder::module_from_position(&db, pos) |
18 | .unwrap() | 19 | .unwrap() |
19 | .unwrap(); | 20 | .unwrap(); |
20 | let module_id = module.def_id.loc(&db).module_id; | 21 | let module_id = module.def_id.loc(&db).module_id; |
21 | (db.item_map(source_root).unwrap(), module_id) | 22 | (db.item_map(source_root).unwrap(), module_id) |
22 | } | 23 | } |
23 | 24 | ||
24 | fn check_module_item_map(map: &hir::ItemMap, module_id: hir::ModuleId, expected: &str) { | 25 | fn check_module_item_map(map: &ItemMap, module_id: ModuleId, expected: &str) { |
25 | let mut lines = map.per_module[&module_id] | 26 | let mut lines = map.per_module[&module_id] |
26 | .items | 27 | .items |
27 | .iter() | 28 | .iter() |
@@ -37,7 +38,7 @@ fn check_module_item_map(map: &hir::ItemMap, module_id: hir::ModuleId, expected: | |||
37 | .join("\n"); | 38 | .join("\n"); |
38 | assert_eq_text!(&expected, &actual); | 39 | assert_eq_text!(&expected, &actual); |
39 | 40 | ||
40 | fn dump_resolution(resolution: &hir::Resolution) -> &'static str { | 41 | fn dump_resolution(resolution: &Resolution) -> &'static str { |
41 | match ( | 42 | match ( |
42 | resolution.def_id.types.is_some(), | 43 | resolution.def_id.types.is_some(), |
43 | resolution.def_id.values.is_some(), | 44 | resolution.def_id.values.is_some(), |
@@ -181,7 +182,7 @@ fn item_map_across_crates() { | |||
181 | db.set_crate_graph(crate_graph); | 182 | db.set_crate_graph(crate_graph); |
182 | 183 | ||
183 | let source_root = db.file_source_root(main_id); | 184 | let source_root = db.file_source_root(main_id); |
184 | let module = hir::source_binder::module_from_file_id(&db, main_id) | 185 | let module = crate::source_binder::module_from_file_id(&db, main_id) |
185 | .unwrap() | 186 | .unwrap() |
186 | .unwrap(); | 187 | .unwrap(); |
187 | let module_id = module.def_id.loc(&db).module_id; | 188 | let module_id = module.def_id.loc(&db).module_id; |