aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/body/lower.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-10 01:32:40 +0000
committerGitHub <[email protected]>2021-03-10 01:32:40 +0000
commit63715e1f732d94f090078d03591fe5569d8890c3 (patch)
treeb08cace121f35753337c0c8e8bee586c8884ee44 /crates/hir_def/src/body/lower.rs
parent654313dbc7fdfc839b79592c5a06dfe8597d55b3 (diff)
parent7beec8fda186e525c0c2d660455a774eeda22e9d (diff)
Merge #7955
7955: Stop fetching ItemTrees for no reason r=jonas-schievink a=jonas-schievink bors r+ Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/hir_def/src/body/lower.rs')
-rw-r--r--crates/hir_def/src/body/lower.rs15
1 files changed, 1 insertions, 14 deletions
diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs
index 4d79ab72c..8c8eb8007 100644
--- a/crates/hir_def/src/body/lower.rs
+++ b/crates/hir_def/src/body/lower.rs
@@ -1,7 +1,7 @@
1//! Transforms `ast::Expr` into an equivalent `hir_def::expr::Expr` 1//! Transforms `ast::Expr` into an equivalent `hir_def::expr::Expr`
2//! representation. 2//! representation.
3 3
4use std::{mem, sync::Arc}; 4use std::mem;
5 5
6use either::Either; 6use either::Either;
7use hir_expand::{ 7use hir_expand::{
@@ -11,7 +11,6 @@ use hir_expand::{
11}; 11};
12use la_arena::Arena; 12use la_arena::Arena;
13use profile::Count; 13use profile::Count;
14use rustc_hash::FxHashMap;
15use syntax::{ 14use syntax::{
16 ast::{ 15 ast::{
17 self, ArgListOwner, ArrayExprKind, AstChildren, LiteralKind, LoopBodyOwner, NameOwner, 16 self, ArgListOwner, ArrayExprKind, AstChildren, LiteralKind, LoopBodyOwner, NameOwner,
@@ -32,7 +31,6 @@ use crate::{
32 Statement, 31 Statement,
33 }, 32 },
34 item_scope::BuiltinShadowMode, 33 item_scope::BuiltinShadowMode,
35 item_tree::ItemTree,
36 path::{GenericArgs, Path}, 34 path::{GenericArgs, Path},
37 type_ref::{Mutability, Rawness, TypeRef}, 35 type_ref::{Mutability, Rawness, TypeRef},
38 AdtId, BlockLoc, ModuleDefId, 36 AdtId, BlockLoc, ModuleDefId,
@@ -63,7 +61,6 @@ pub(super) fn lower(
63 params: Option<ast::ParamList>, 61 params: Option<ast::ParamList>,
64 body: Option<ast::Expr>, 62 body: Option<ast::Expr>,
65) -> (Body, BodySourceMap) { 63) -> (Body, BodySourceMap) {
66 let item_tree = db.item_tree(expander.current_file_id);
67 ExprCollector { 64 ExprCollector {
68 db, 65 db,
69 source_map: BodySourceMap::default(), 66 source_map: BodySourceMap::default(),
@@ -76,11 +73,6 @@ pub(super) fn lower(
76 block_scopes: Vec::new(), 73 block_scopes: Vec::new(),
77 _c: Count::new(), 74 _c: Count::new(),
78 }, 75 },
79 item_trees: {
80 let mut map = FxHashMap::default();
81 map.insert(expander.current_file_id, item_tree);
82 map
83 },
84 expander, 76 expander,
85 } 77 }
86 .collect(params, body) 78 .collect(params, body)
@@ -91,8 +83,6 @@ struct ExprCollector<'a> {
91 expander: Expander, 83 expander: Expander,
92 body: Body, 84 body: Body,
93 source_map: BodySourceMap, 85 source_map: BodySourceMap,
94
95 item_trees: FxHashMap<HirFileId, Arc<ItemTree>>,
96} 86}
97 87
98impl ExprCollector<'_> { 88impl ExprCollector<'_> {
@@ -589,9 +579,6 @@ impl ExprCollector<'_> {
589 } else { 579 } else {
590 self.source_map.expansions.insert(macro_call, self.expander.current_file_id); 580 self.source_map.expansions.insert(macro_call, self.expander.current_file_id);
591 581
592 let item_tree = self.db.item_tree(self.expander.current_file_id);
593 self.item_trees.insert(self.expander.current_file_id, item_tree);
594
595 let id = collector(self, Some(expansion)); 582 let id = collector(self, Some(expansion));
596 self.expander.exit(self.db, mark); 583 self.expander.exit(self.db, mark);
597 id 584 id