aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/Cargo.toml1
-rw-r--r--crates/ra_hir/src/nameres.rs7
-rw-r--r--crates/ra_hir/src/nameres/collector.rs3
3 files changed, 2 insertions, 9 deletions
diff --git a/crates/ra_hir/Cargo.toml b/crates/ra_hir/Cargo.toml
index f955dc3e6..d9bed4dda 100644
--- a/crates/ra_hir/Cargo.toml
+++ b/crates/ra_hir/Cargo.toml
@@ -6,7 +6,6 @@ authors = ["rust-analyzer developers"]
6 6
7[dependencies] 7[dependencies]
8arrayvec = "0.4.10" 8arrayvec = "0.4.10"
9im = "13.0.0"
10log = "0.4.5" 9log = "0.4.5"
11relative-path = "0.4.0" 10relative-path = "0.4.0"
12rustc-hash = "1.0" 11rustc-hash = "1.0"
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
index 7e5138d05..befbb2a9b 100644
--- a/crates/ra_hir/src/nameres.rs
+++ b/crates/ra_hir/src/nameres.rs
@@ -54,7 +54,6 @@ mod mod_resolution;
54#[cfg(test)] 54#[cfg(test)]
55mod tests; 55mod tests;
56 56
57use std::hash::BuildHasherDefault;
58use std::sync::Arc; 57use std::sync::Arc;
59 58
60use once_cell::sync::Lazy; 59use once_cell::sync::Lazy;
@@ -62,7 +61,7 @@ use ra_arena::{impl_arena_id, Arena, RawId};
62use ra_db::{Edition, FileId}; 61use ra_db::{Edition, FileId};
63use ra_prof::profile; 62use ra_prof::profile;
64use ra_syntax::ast; 63use ra_syntax::ast;
65use rustc_hash::{FxHashMap, FxHashSet, FxHasher}; 64use rustc_hash::{FxHashMap, FxHashSet};
66use test_utils::tested_by; 65use test_utils::tested_by;
67 66
68use crate::{ 67use crate::{
@@ -74,8 +73,6 @@ use crate::{
74 AstId, BuiltinType, Crate, HirFileId, MacroDef, Module, ModuleDef, Name, Path, PathKind, Trait, 73 AstId, BuiltinType, Crate, HirFileId, MacroDef, Module, ModuleDef, Name, Path, PathKind, Trait,
75}; 74};
76 75
77pub(crate) type ImmFxHashMap<K, V> = im::HashMap<K, V, BuildHasherDefault<FxHasher>>;
78
79pub(crate) use self::raw::{ImportSourceMap, RawItems}; 76pub(crate) use self::raw::{ImportSourceMap, RawItems};
80 77
81pub use self::{ 78pub use self::{
@@ -142,7 +139,7 @@ pub(crate) struct ModuleData {
142pub struct ModuleScope { 139pub struct ModuleScope {
143 items: FxHashMap<Name, Resolution>, 140 items: FxHashMap<Name, Resolution>,
144 macros: FxHashMap<Name, MacroDef>, 141 macros: FxHashMap<Name, MacroDef>,
145 textual_macros: ImmFxHashMap<Name, MacroDef>, 142 textual_macros: FxHashMap<Name, MacroDef>,
146} 143}
147 144
148static BUILTIN_SCOPE: Lazy<FxHashMap<Name, Resolution>> = Lazy::new(|| { 145static BUILTIN_SCOPE: Lazy<FxHashMap<Name, Resolution>> = Lazy::new(|| {
diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs
index 3803c7185..10c32ffa1 100644
--- a/crates/ra_hir/src/nameres/collector.rs
+++ b/crates/ra_hir/src/nameres/collector.rs
@@ -631,7 +631,6 @@ where
631 modules[res].parent = Some(self.module_id); 631 modules[res].parent = Some(self.module_id);
632 modules[res].declaration = Some(declaration); 632 modules[res].declaration = Some(declaration);
633 modules[res].definition = definition; 633 modules[res].definition = definition;
634 // Cloning immutable map is lazy and fast
635 modules[res].scope.textual_macros = modules[self.module_id].scope.textual_macros.clone(); 634 modules[res].scope.textual_macros = modules[self.module_id].scope.textual_macros.clone();
636 modules[self.module_id].children.insert(name.clone(), res); 635 modules[self.module_id].children.insert(name.clone(), res);
637 let resolution = Resolution { 636 let resolution = Resolution {
@@ -708,8 +707,6 @@ where
708 } 707 }
709 708
710 fn import_all_textual_macros(&mut self, module_id: CrateModuleId) { 709 fn import_all_textual_macros(&mut self, module_id: CrateModuleId) {
711 // `clone()` is needed here to avoid mutable borrow `self.def_collector` when first borrow is alive
712 // Cloning immutable map is lazy and fast
713 let macros = self.def_collector.def_map[module_id].scope.textual_macros.clone(); 710 let macros = self.def_collector.def_map[module_id].scope.textual_macros.clone();
714 for (name, macro_) in macros { 711 for (name, macro_) in macros {
715 self.def_collector.define_textual_macro(self.module_id, name.clone(), macro_.id); 712 self.def_collector.define_textual_macro(self.module_id, name.clone(), macro_.id);