aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/nameres.rs
diff options
context:
space:
mode:
authoruHOOCCOOHu <[email protected]>2019-09-07 17:05:58 +0100
committeruHOOCCOOHu <[email protected]>2019-09-08 18:34:53 +0100
commitf7f7c2aff80f0870f0d71bf70075e3b5bf68994f (patch)
tree194c41ab1320730d7f08823127404056e235cf2e /crates/ra_hir/src/nameres.rs
parentc90256429bf41958ff6c7390dfd5fa25123eabb3 (diff)
Revert "Replace with immutable map to avoid heavy cloning"
This reverts commit 2c494eb803c88ef5d23607c3b156fce60c2b8076. See: https://github.com/rust-analyzer/rust-analyzer/pull/1784#issuecomment-529119924
Diffstat (limited to 'crates/ra_hir/src/nameres.rs')
-rw-r--r--crates/ra_hir/src/nameres.rs7
1 files changed, 2 insertions, 5 deletions
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(|| {