aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir/src/nameres.rs6
-rw-r--r--crates/ra_hir/src/source_binder.rs6
-rw-r--r--crates/ra_hir/src/source_id.rs2
3 files changed, 6 insertions, 8 deletions
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
index d8fa2383f..36ef615a3 100644
--- a/crates/ra_hir/src/nameres.rs
+++ b/crates/ra_hir/src/nameres.rs
@@ -61,9 +61,8 @@ use ra_db::{FileId, Edition};
61use test_utils::tested_by; 61use test_utils::tested_by;
62 62
63use crate::{ 63use crate::{
64 ModuleDef, Name, Crate, Module, 64 ModuleDef, Name, Crate, Module, SourceItemId,
65 DefDatabase, Path, PathKind, HirFileId, Trait, 65 DefDatabase, Path, PathKind, HirFileId, Trait,
66 SourceItemId, SourceFileItemId,
67 ids::{MacroCallId, MacroDefId}, 66 ids::{MacroCallId, MacroDefId},
68 diagnostics::DiagnosticSink, 67 diagnostics::DiagnosticSink,
69 nameres::diagnostics::DefDiagnostic, 68 nameres::diagnostics::DefDiagnostic,
@@ -242,9 +241,8 @@ impl CrateDefMap {
242 pub(crate) fn find_module_by_source( 241 pub(crate) fn find_module_by_source(
243 &self, 242 &self,
244 file_id: HirFileId, 243 file_id: HirFileId,
245 decl_id: Option<SourceFileItemId>, 244 decl_id: Option<SourceItemId>,
246 ) -> Option<CrateModuleId> { 245 ) -> Option<CrateModuleId> {
247 let decl_id = decl_id.map(|it| it.with_file_id(file_id));
248 let (module_id, _module_data) = self.modules.iter().find(|(_module_id, module_data)| { 246 let (module_id, _module_data) = self.modules.iter().find(|(_module_id, module_data)| {
249 if decl_id.is_some() { 247 if decl_id.is_some() {
250 module_data.declaration == decl_id 248 module_data.declaration == decl_id
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index 6e157007f..db9e3a22e 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -13,7 +13,7 @@ use ra_syntax::{
13}; 13};
14 14
15use crate::{ 15use crate::{
16 HirDatabase, Function, Struct, Enum, SourceFileItemId, 16 HirDatabase, Function, Struct, Enum, SourceItemId,
17 AsName, Module, HirFileId, Crate, Trait, Resolver, 17 AsName, Module, HirFileId, Crate, Trait, Resolver,
18 ids::LocationCtx, 18 ids::LocationCtx,
19 expr 19 expr
@@ -55,7 +55,7 @@ fn module_from_inline(
55 assert!(!module.has_semi()); 55 assert!(!module.has_semi());
56 let file_id = file_id.into(); 56 let file_id = file_id.into();
57 let file_items = db.file_items(file_id); 57 let file_items = db.file_items(file_id);
58 let item_id = file_items.id_of(file_id, module.syntax()); 58 let item_id = file_items.id_of(file_id, module.syntax()).with_file_id(file_id);
59 module_from_source(db, file_id, Some(item_id)) 59 module_from_source(db, file_id, Some(item_id))
60} 60}
61 61
@@ -75,7 +75,7 @@ pub fn module_from_child_node(
75fn module_from_source( 75fn module_from_source(
76 db: &impl HirDatabase, 76 db: &impl HirDatabase,
77 file_id: HirFileId, 77 file_id: HirFileId,
78 decl_id: Option<SourceFileItemId>, 78 decl_id: Option<SourceItemId>,
79) -> Option<Module> { 79) -> Option<Module> {
80 let source_root_id = db.file_source_root(file_id.as_original_file()); 80 let source_root_id = db.file_source_root(file_id.as_original_file());
81 db.source_root_crates(source_root_id).iter().map(|&crate_id| Crate { crate_id }).find_map( 81 db.source_root_crates(source_root_id).iter().map(|&crate_id| Crate { crate_id }).find_map(
diff --git a/crates/ra_hir/src/source_id.rs b/crates/ra_hir/src/source_id.rs
index f961adf8b..62707ba6a 100644
--- a/crates/ra_hir/src/source_id.rs
+++ b/crates/ra_hir/src/source_id.rs
@@ -8,7 +8,7 @@ use crate::{HirFileId, DefDatabase};
8/// Identifier of item within a specific file. This is stable over reparses, so 8/// Identifier of item within a specific file. This is stable over reparses, so
9/// it's OK to use it as a salsa key/value. 9/// it's OK to use it as a salsa key/value.
10#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] 10#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
11pub struct SourceFileItemId(RawId); 11pub(crate) struct SourceFileItemId(RawId);
12impl_arena_id!(SourceFileItemId); 12impl_arena_id!(SourceFileItemId);
13 13
14impl SourceFileItemId { 14impl SourceFileItemId {