aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/intern.rs
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-04-05 02:50:10 +0100
committerJonas Schievink <[email protected]>2021-04-05 02:50:10 +0100
commit7c0c713a102ee86ee32af115acba63a5c3b3a657 (patch)
treeefa1f5aee1521d720bc6e83db26b53f00d7562a0 /crates/hir_def/src/intern.rs
parentadcf18e27dc04b60fede859f3d6c22b99d4fd513 (diff)
Intern `GenericParams`
Also share the same instance between `ItemTree` and `generic_params` query.
Diffstat (limited to 'crates/hir_def/src/intern.rs')
-rw-r--r--crates/hir_def/src/intern.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/hir_def/src/intern.rs b/crates/hir_def/src/intern.rs
index d163f633f..2467e9299 100644
--- a/crates/hir_def/src/intern.rs
+++ b/crates/hir_def/src/intern.rs
@@ -14,6 +14,8 @@ use dashmap::{lock::RwLockWriteGuard, DashMap, SharedValue};
14use once_cell::sync::OnceCell; 14use once_cell::sync::OnceCell;
15use rustc_hash::FxHasher; 15use rustc_hash::FxHasher;
16 16
17use crate::generics::GenericParams;
18
17type InternMap<T> = DashMap<Arc<T>, (), BuildHasherDefault<FxHasher>>; 19type InternMap<T> = DashMap<Arc<T>, (), BuildHasherDefault<FxHasher>>;
18type Guard<T> = 20type Guard<T> =
19 RwLockWriteGuard<'static, HashMap<Arc<T>, SharedValue<()>, BuildHasherDefault<FxHasher>>>; 21 RwLockWriteGuard<'static, HashMap<Arc<T>, SharedValue<()>, BuildHasherDefault<FxHasher>>>;
@@ -194,4 +196,10 @@ macro_rules! impl_internable {
194 )+ }; 196 )+ };
195} 197}
196 198
197impl_internable!(crate::type_ref::TypeRef, crate::type_ref::TraitRef, crate::path::ModPath, str); 199impl_internable!(
200 crate::type_ref::TypeRef,
201 crate::type_ref::TraitRef,
202 crate::path::ModPath,
203 GenericParams,
204 str
205);