aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/code_model_impl/krate.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-06 17:01:49 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-06 17:01:49 +0000
commit0d59422b18de8dce416d792b9e7dbe9b8d5aa30a (patch)
tree2032c28d8a72b162abe9f7b8dddffef7f036b91d /crates/ra_hir/src/code_model_impl/krate.rs
parentcf0ce14351af03c620aca784ee2c03aad86b866e (diff)
parent8a3b489c2f57bdf8f6241e69276efa48b5ed4a98 (diff)
Merge #445
445: kill module source r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/code_model_impl/krate.rs')
-rw-r--r--crates/ra_hir/src/code_model_impl/krate.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/ra_hir/src/code_model_impl/krate.rs b/crates/ra_hir/src/code_model_impl/krate.rs
index 591a81597..3275eafed 100644
--- a/crates/ra_hir/src/code_model_impl/krate.rs
+++ b/crates/ra_hir/src/code_model_impl/krate.rs
@@ -1,7 +1,7 @@
1use ra_db::{CrateId, Cancelable}; 1use ra_db::{CrateId, Cancelable};
2 2
3use crate::{ 3use crate::{
4 HirFileId, Crate, CrateDependency, AsName, DefLoc, DefKind, Module, 4 HirFileId, Crate, CrateDependency, AsName, DefLoc, DefKind, Module, SourceItemId,
5 db::HirDatabase, 5 db::HirDatabase,
6}; 6};
7 7
@@ -27,15 +27,17 @@ impl Crate {
27 let file_id = HirFileId::from(file_id); 27 let file_id = HirFileId::from(file_id);
28 let module_tree = db.module_tree(source_root_id)?; 28 let module_tree = db.module_tree(source_root_id)?;
29 // FIXME: teach module tree about crate roots instead of guessing 29 // FIXME: teach module tree about crate roots instead of guessing
30 let (module_id, _) = ctry!(module_tree 30 let source = SourceItemId {
31 .modules_with_sources() 31 file_id,
32 .find(|(_, src)| src.file_id() == file_id)); 32 item_id: None,
33 };
34 let module_id = ctry!(module_tree.find_module_by_source(source));
33 35
34 let def_loc = DefLoc { 36 let def_loc = DefLoc {
35 kind: DefKind::Module, 37 kind: DefKind::Module,
36 source_root_id, 38 source_root_id,
37 module_id, 39 module_id,
38 source_item_id: module_id.source(&module_tree).0, 40 source_item_id: module_id.source(&module_tree),
39 }; 41 };
40 let def_id = def_loc.id(db); 42 let def_id = def_loc.id(db);
41 43