aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock27
-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
4 files changed, 2 insertions, 36 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 7f329c4db..f93f11a82 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -485,16 +485,6 @@ dependencies = [
485] 485]
486 486
487[[package]] 487[[package]]
488name = "im"
489version = "13.0.0"
490source = "registry+https://github.com/rust-lang/crates.io-index"
491dependencies = [
492 "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
493 "sized-chunks 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
494 "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
495]
496
497[[package]]
498name = "indexmap" 488name = "indexmap"
499version = "1.1.0" 489version = "1.1.0"
500source = "registry+https://github.com/rust-lang/crates.io-index" 490source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1016,7 +1006,6 @@ dependencies = [
1016 "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)", 1006 "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)",
1017 "chalk-solve 0.1.0 (git+https://github.com/rust-lang/chalk.git)", 1007 "chalk-solve 0.1.0 (git+https://github.com/rust-lang/chalk.git)",
1018 "ena 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", 1008 "ena 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
1019 "im 13.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
1020 "insta 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 1009 "insta 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
1021 "lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", 1010 "lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
1022 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 1011 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1562,14 +1551,6 @@ dependencies = [
1562] 1551]
1563 1552
1564[[package]] 1553[[package]]
1565name = "sized-chunks"
1566version = "0.3.1"
1567source = "registry+https://github.com/rust-lang/crates.io-index"
1568dependencies = [
1569 "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
1570]
1571
1572[[package]]
1573name = "slab" 1554name = "slab"
1574version = "0.4.2" 1555version = "0.4.2"
1575source = "registry+https://github.com/rust-lang/crates.io-index" 1556source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1704,11 +1685,6 @@ dependencies = [
1704] 1685]
1705 1686
1706[[package]] 1687[[package]]
1707name = "typenum"
1708version = "1.11.2"
1709source = "registry+https://github.com/rust-lang/crates.io-index"
1710
1711[[package]]
1712name = "unicase" 1688name = "unicase"
1713version = "2.5.1" 1689version = "2.5.1"
1714source = "registry+https://github.com/rust-lang/crates.io-index" 1690source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1917,7 +1893,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1917"checksum globset 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "925aa2cac82d8834e2b2a4415b6f6879757fb5c0928fc445ae76461a12eed8f2" 1893"checksum globset 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "925aa2cac82d8834e2b2a4415b6f6879757fb5c0928fc445ae76461a12eed8f2"
1918"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" 1894"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
1919"checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" 1895"checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9"
1920"checksum im 13.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8db49f8bc08d5cc4e2bb0f7d25a6d1db2c79bc6f7d7c86c96c657eb3d214125f"
1921"checksum indexmap 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a4d6d89e0948bf10c08b9ecc8ac5b83f07f857ebe2c0cbe38de15b4e4f510356" 1896"checksum indexmap 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a4d6d89e0948bf10c08b9ecc8ac5b83f07f857ebe2c0cbe38de15b4e4f510356"
1922"checksum indicatif 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2c60da1c9abea75996b70a931bba6c750730399005b61ccd853cee50ef3d0d0c" 1897"checksum indicatif 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2c60da1c9abea75996b70a931bba6c750730399005b61ccd853cee50ef3d0d0c"
1923"checksum inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40b54539f3910d6f84fbf9a643efd6e3aa6e4f001426c0329576128255994718" 1898"checksum inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40b54539f3910d6f84fbf9a643efd6e3aa6e4f001426c0329576128255994718"
@@ -2012,7 +1987,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
2012"checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" 1987"checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704"
2013"checksum serde_repr 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "cd02c7587ec314570041b2754829f84d873ced14a96d1fd1823531e11db40573" 1988"checksum serde_repr 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "cd02c7587ec314570041b2754829f84d873ced14a96d1fd1823531e11db40573"
2014"checksum serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)" = "38b08a9a90e5260fe01c6480ec7c811606df6d3a660415808c3c3fa8ed95b582" 1989"checksum serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)" = "38b08a9a90e5260fe01c6480ec7c811606df6d3a660415808c3c3fa8ed95b582"
2015"checksum sized-chunks 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f01db57d7ee89c8e053245deb77040a6cc8508311f381c88749c33d4b9b78785"
2016"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" 1990"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
2017"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7" 1991"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7"
2018"checksum smol_str 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "590700be3630457c56f8c73c0ea39881476ad7076cd84057d44f4f38f79914fb" 1992"checksum smol_str 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "590700be3630457c56f8c73c0ea39881476ad7076cd84057d44f4f38f79914fb"
@@ -2028,7 +2002,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
2028"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" 2002"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
2029"checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865" 2003"checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865"
2030"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" 2004"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
2031"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9"
2032"checksum unicase 2.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2e2e6bd1e59e56598518beb94fd6db628ded570326f0a98c679a304bd9f00150" 2005"checksum unicase 2.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2e2e6bd1e59e56598518beb94fd6db628ded570326f0a98c679a304bd9f00150"
2033"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" 2006"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
2034"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" 2007"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426"
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);