diff options
Diffstat (limited to 'crates/hir_def/src/body')
-rw-r--r-- | crates/hir_def/src/body/lower.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs index 540c6c9ad..28b11cdde 100644 --- a/crates/hir_def/src/body/lower.rs +++ b/crates/hir_def/src/body/lower.rs | |||
@@ -698,15 +698,15 @@ impl ExprCollector<'_> { | |||
698 | 698 | ||
699 | fn collect_block(&mut self, block: ast::BlockExpr) -> ExprId { | 699 | fn collect_block(&mut self, block: ast::BlockExpr) -> ExprId { |
700 | let ast_id = self.expander.ast_id(&block); | 700 | let ast_id = self.expander.ast_id(&block); |
701 | let block_loc = BlockLoc { ast_id, module: self.expander.module }; | 701 | let block_loc = |
702 | BlockLoc { ast_id, module: self.expander.def_map.module_id(self.expander.module) }; | ||
702 | let block_id = self.db.intern_block(block_loc); | 703 | let block_id = self.db.intern_block(block_loc); |
703 | let opt_def_map = self.db.block_def_map(block_id); | 704 | let opt_def_map = self.db.block_def_map(block_id); |
704 | let has_def_map = opt_def_map.is_some(); | 705 | let has_def_map = opt_def_map.is_some(); |
705 | let def_map = opt_def_map.unwrap_or_else(|| self.expander.def_map.clone()); | 706 | let def_map = opt_def_map.unwrap_or_else(|| self.expander.def_map.clone()); |
706 | let module = | 707 | let module = if has_def_map { def_map.root() } else { self.expander.module }; |
707 | if has_def_map { def_map.module_id(def_map.root()) } else { self.expander.module }; | ||
708 | let prev_def_map = mem::replace(&mut self.expander.def_map, def_map); | 708 | let prev_def_map = mem::replace(&mut self.expander.def_map, def_map); |
709 | let prev_module = mem::replace(&mut self.expander.module, module); | 709 | let prev_local_module = mem::replace(&mut self.expander.module, module); |
710 | 710 | ||
711 | self.collect_stmts_items(block.statements()); | 711 | self.collect_stmts_items(block.statements()); |
712 | let statements = | 712 | let statements = |
@@ -719,7 +719,7 @@ impl ExprCollector<'_> { | |||
719 | ); | 719 | ); |
720 | 720 | ||
721 | self.expander.def_map = prev_def_map; | 721 | self.expander.def_map = prev_def_map; |
722 | self.expander.module = prev_module; | 722 | self.expander.module = prev_local_module; |
723 | expr_id | 723 | expr_id |
724 | } | 724 | } |
725 | 725 | ||
@@ -812,7 +812,7 @@ impl ExprCollector<'_> { | |||
812 | } | 812 | } |
813 | Either::Right(e) => { | 813 | Either::Right(e) => { |
814 | let mac = MacroDefId { | 814 | let mac = MacroDefId { |
815 | krate: self.expander.module.krate, | 815 | krate: self.expander.def_map.krate(), |
816 | ast_id: Some(self.expander.ast_id(&e)), | 816 | ast_id: Some(self.expander.ast_id(&e)), |
817 | kind: MacroDefKind::Declarative, | 817 | kind: MacroDefKind::Declarative, |
818 | local_inner: false, | 818 | local_inner: false, |
@@ -852,7 +852,7 @@ impl ExprCollector<'_> { | |||
852 | // decide that, we need to try resolving the name. | 852 | // decide that, we need to try resolving the name. |
853 | let (resolved, _) = self.expander.def_map.resolve_path( | 853 | let (resolved, _) = self.expander.def_map.resolve_path( |
854 | self.db, | 854 | self.db, |
855 | self.expander.module.local_id, | 855 | self.expander.module, |
856 | &name.clone().into(), | 856 | &name.clone().into(), |
857 | BuiltinShadowMode::Other, | 857 | BuiltinShadowMode::Other, |
858 | ); | 858 | ); |