aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/nameres/collector.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-04-03 20:01:03 +0100
committerGitHub <[email protected]>2021-04-03 20:01:03 +0100
commitb78f1a0a4d90276c7bd99bd0e5ac6959578be76a (patch)
tree9e5444bdd56ad6725525764d9f35a20f927b2209 /crates/hir_def/src/nameres/collector.rs
parente2213a503ec4c602eb976dccb9d34b56d9c6aba3 (diff)
parentee4b5a34d8aa789ebc521926123fba79eebe5981 (diff)
Merge #8315
8315: Try to reduce ItemTree size further r=jonas-schievink a=jonas-schievink This was mostly a failed experiment, but still seems like the right thing to do. Memory reduction is mostly negligible. bors r+ Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/hir_def/src/nameres/collector.rs')
-rw-r--r--crates/hir_def/src/nameres/collector.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs
index c8f494707..c2e445b68 100644
--- a/crates/hir_def/src/nameres/collector.rs
+++ b/crates/hir_def/src/nameres/collector.rs
@@ -23,6 +23,7 @@ use crate::{
23 attr::Attrs, 23 attr::Attrs,
24 db::DefDatabase, 24 db::DefDatabase,
25 derive_macro_as_call_id, 25 derive_macro_as_call_id,
26 intern::Interned,
26 item_scope::{ImportType, PerNsGlobImports}, 27 item_scope::{ImportType, PerNsGlobImports},
27 item_tree::{ 28 item_tree::{
28 self, FileItemTreeId, ItemTree, ItemTreeId, MacroCall, MacroDef, MacroRules, Mod, ModItem, 29 self, FileItemTreeId, ItemTree, ItemTreeId, MacroCall, MacroDef, MacroRules, Mod, ModItem,
@@ -139,7 +140,7 @@ enum ImportSource {
139 140
140#[derive(Clone, Debug, Eq, PartialEq)] 141#[derive(Clone, Debug, Eq, PartialEq)]
141struct Import { 142struct Import {
142 path: ModPath, 143 path: Interned<ModPath>,
143 alias: Option<ImportAlias>, 144 alias: Option<ImportAlias>,
144 visibility: RawVisibility, 145 visibility: RawVisibility,
145 is_glob: bool, 146 is_glob: bool,
@@ -181,7 +182,10 @@ impl Import {
181 let attrs = &tree.attrs(db, krate, ModItem::from(id.value).into()); 182 let attrs = &tree.attrs(db, krate, ModItem::from(id.value).into());
182 let visibility = &tree[it.visibility]; 183 let visibility = &tree[it.visibility];
183 Self { 184 Self {
184 path: ModPath::from_segments(PathKind::Plain, iter::once(it.name.clone())), 185 path: Interned::new(ModPath::from_segments(
186 PathKind::Plain,
187 iter::once(it.name.clone()),
188 )),
185 alias: it.alias.clone(), 189 alias: it.alias.clone(),
186 visibility: visibility.clone(), 190 visibility: visibility.clone(),
187 is_glob: false, 191 is_glob: false,