diff options
Diffstat (limited to 'crates/hir_def/src/nameres')
-rw-r--r-- | crates/hir_def/src/nameres/collector.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs index 761b29c86..ae98fadac 100644 --- a/crates/hir_def/src/nameres/collector.rs +++ b/crates/hir_def/src/nameres/collector.rs | |||
@@ -48,7 +48,7 @@ const FIXED_POINT_LIMIT: usize = 8192; | |||
48 | pub(super) fn collect_defs( | 48 | pub(super) fn collect_defs( |
49 | db: &dyn DefDatabase, | 49 | db: &dyn DefDatabase, |
50 | mut def_map: DefMap, | 50 | mut def_map: DefMap, |
51 | block: Option<FileAstId<ast::BlockExpr>>, | 51 | block: Option<AstId<ast::BlockExpr>>, |
52 | ) -> DefMap { | 52 | ) -> DefMap { |
53 | let crate_graph = db.crate_graph(); | 53 | let crate_graph = db.crate_graph(); |
54 | 54 | ||
@@ -261,11 +261,10 @@ impl DefCollector<'_> { | |||
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | fn seed_with_inner(&mut self, block: FileAstId<ast::BlockExpr>) { | 264 | fn seed_with_inner(&mut self, block: AstId<ast::BlockExpr>) { |
265 | let file_id = self.db.crate_graph()[self.def_map.krate].root_file_id; | 265 | let item_tree = self.db.item_tree(block.file_id); |
266 | let item_tree = self.db.item_tree(file_id.into()); | ||
267 | let module_id = self.def_map.root; | 266 | let module_id = self.def_map.root; |
268 | self.def_map.modules[module_id].origin = ModuleOrigin::CrateRoot { definition: file_id }; | 267 | self.def_map.modules[module_id].origin = ModuleOrigin::BlockExpr { block }; |
269 | if item_tree | 268 | if item_tree |
270 | .top_level_attrs(self.db, self.def_map.krate) | 269 | .top_level_attrs(self.db, self.def_map.krate) |
271 | .cfg() | 270 | .cfg() |
@@ -275,11 +274,11 @@ impl DefCollector<'_> { | |||
275 | def_collector: &mut *self, | 274 | def_collector: &mut *self, |
276 | macro_depth: 0, | 275 | macro_depth: 0, |
277 | module_id, | 276 | module_id, |
278 | file_id: file_id.into(), | 277 | file_id: block.file_id, |
279 | item_tree: &item_tree, | 278 | item_tree: &item_tree, |
280 | mod_dir: ModDir::root(), | 279 | mod_dir: ModDir::root(), |
281 | } | 280 | } |
282 | .collect(item_tree.inner_items_of_block(block)); | 281 | .collect(item_tree.inner_items_of_block(block.value)); |
283 | } | 282 | } |
284 | } | 283 | } |
285 | 284 | ||