diff options
Diffstat (limited to 'crates/ra_hir/src/nameres')
-rw-r--r-- | crates/ra_hir/src/nameres/collector.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/nameres/raw.rs | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs index 4640b3b74..c615d80c3 100644 --- a/crates/ra_hir/src/nameres/collector.rs +++ b/crates/ra_hir/src/nameres/collector.rs | |||
@@ -15,7 +15,7 @@ use crate::{ | |||
15 | diagnostics::DefDiagnostic, | 15 | diagnostics::DefDiagnostic, |
16 | raw, | 16 | raw, |
17 | }, | 17 | }, |
18 | ids::{AstItemDef, LocationCtx, MacroCallLoc, MacroCallId, MacroDefId}, | 18 | ids::{AstItemDef, LocationCtx, MacroCallLoc, MacroCallId, MacroDefId, MacroFileKind}, |
19 | AstId, | 19 | AstId, |
20 | }; | 20 | }; |
21 | 21 | ||
@@ -371,7 +371,7 @@ where | |||
371 | self.macro_stack_monitor.increase(macro_def_id); | 371 | self.macro_stack_monitor.increase(macro_def_id); |
372 | 372 | ||
373 | if !self.macro_stack_monitor.is_poison(macro_def_id) { | 373 | if !self.macro_stack_monitor.is_poison(macro_def_id) { |
374 | let file_id: HirFileId = macro_call_id.into(); | 374 | let file_id: HirFileId = macro_call_id.as_file(MacroFileKind::Items); |
375 | let raw_items = self.db.raw_items(file_id); | 375 | let raw_items = self.db.raw_items(file_id); |
376 | ModCollector { def_collector: &mut *self, file_id, module_id, raw_items: &raw_items } | 376 | ModCollector { def_collector: &mut *self, file_id, module_id, raw_items: &raw_items } |
377 | .collect(raw_items.items()); | 377 | .collect(raw_items.items()); |
diff --git a/crates/ra_hir/src/nameres/raw.rs b/crates/ra_hir/src/nameres/raw.rs index 211e02068..bd32b264b 100644 --- a/crates/ra_hir/src/nameres/raw.rs +++ b/crates/ra_hir/src/nameres/raw.rs | |||
@@ -75,8 +75,11 @@ impl RawItems { | |||
75 | source_ast_id_map: db.ast_id_map(file_id.into()), | 75 | source_ast_id_map: db.ast_id_map(file_id.into()), |
76 | source_map: ImportSourceMap::default(), | 76 | source_map: ImportSourceMap::default(), |
77 | }; | 77 | }; |
78 | let source_file = db.hir_parse(file_id); | 78 | if let Some(node) = db.parse_or_expand(file_id) { |
79 | collector.process_module(None, &*source_file); | 79 | if let Some(source_file) = ast::SourceFile::cast(&node) { |
80 | collector.process_module(None, &*source_file); | ||
81 | } | ||
82 | } | ||
80 | (Arc::new(collector.raw_items), Arc::new(collector.source_map)) | 83 | (Arc::new(collector.raw_items), Arc::new(collector.source_map)) |
81 | } | 84 | } |
82 | 85 | ||