diff options
-rw-r--r-- | crates/ra_db/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/ra_db/src/loc2id.rs | 10 | ||||
-rw-r--r-- | crates/ra_hir/src/ids.rs | 34 |
3 files changed, 23 insertions, 23 deletions
diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs index e006c6d27..f3389c91f 100644 --- a/crates/ra_db/src/lib.rs +++ b/crates/ra_db/src/lib.rs | |||
@@ -16,7 +16,7 @@ pub use crate::{ | |||
16 | input::{ | 16 | input::{ |
17 | FileId, CrateId, SourceRoot, SourceRootId, CrateGraph, Dependency, Edition, | 17 | FileId, CrateId, SourceRoot, SourceRootId, CrateGraph, Dependency, Edition, |
18 | }, | 18 | }, |
19 | loc2id::LocationIntener, | 19 | loc2id::LocationInterner, |
20 | }; | 20 | }; |
21 | 21 | ||
22 | pub trait CheckCanceled: panic::RefUnwindSafe { | 22 | pub trait CheckCanceled: panic::RefUnwindSafe { |
diff --git a/crates/ra_db/src/loc2id.rs b/crates/ra_db/src/loc2id.rs index d27fa7682..eae64a4eb 100644 --- a/crates/ra_db/src/loc2id.rs +++ b/crates/ra_db/src/loc2id.rs | |||
@@ -59,7 +59,7 @@ where | |||
59 | } | 59 | } |
60 | 60 | ||
61 | #[derive(Debug)] | 61 | #[derive(Debug)] |
62 | pub struct LocationIntener<LOC, ID> | 62 | pub struct LocationInterner<LOC, ID> |
63 | where | 63 | where |
64 | ID: ArenaId + Clone, | 64 | ID: ArenaId + Clone, |
65 | LOC: Clone + Eq + Hash, | 65 | LOC: Clone + Eq + Hash, |
@@ -67,7 +67,7 @@ where | |||
67 | map: Mutex<Loc2IdMap<LOC, ID>>, | 67 | map: Mutex<Loc2IdMap<LOC, ID>>, |
68 | } | 68 | } |
69 | 69 | ||
70 | impl<LOC, ID> panic::RefUnwindSafe for LocationIntener<LOC, ID> | 70 | impl<LOC, ID> panic::RefUnwindSafe for LocationInterner<LOC, ID> |
71 | where | 71 | where |
72 | ID: ArenaId + Clone, | 72 | ID: ArenaId + Clone, |
73 | LOC: Clone + Eq + Hash, | 73 | LOC: Clone + Eq + Hash, |
@@ -76,17 +76,17 @@ where | |||
76 | { | 76 | { |
77 | } | 77 | } |
78 | 78 | ||
79 | impl<LOC, ID> Default for LocationIntener<LOC, ID> | 79 | impl<LOC, ID> Default for LocationInterner<LOC, ID> |
80 | where | 80 | where |
81 | ID: ArenaId + Clone, | 81 | ID: ArenaId + Clone, |
82 | LOC: Clone + Eq + Hash, | 82 | LOC: Clone + Eq + Hash, |
83 | { | 83 | { |
84 | fn default() -> Self { | 84 | fn default() -> Self { |
85 | LocationIntener { map: Default::default() } | 85 | LocationInterner { map: Default::default() } |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | impl<LOC, ID> LocationIntener<LOC, ID> | 89 | impl<LOC, ID> LocationInterner<LOC, ID> |
90 | where | 90 | where |
91 | ID: ArenaId + Clone, | 91 | ID: ArenaId + Clone, |
92 | LOC: Clone + Eq + Hash, | 92 | LOC: Clone + Eq + Hash, |
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs index 9596488d3..3d0a881c2 100644 --- a/crates/ra_hir/src/ids.rs +++ b/crates/ra_hir/src/ids.rs | |||
@@ -4,7 +4,7 @@ use std::{ | |||
4 | sync::Arc, | 4 | sync::Arc, |
5 | }; | 5 | }; |
6 | 6 | ||
7 | use ra_db::{LocationIntener, FileId}; | 7 | use ra_db::{LocationInterner, FileId}; |
8 | use ra_syntax::{TreeArc, SyntaxNode, SourceFile, AstNode, SyntaxNodePtr, ast}; | 8 | use ra_syntax::{TreeArc, SyntaxNode, SourceFile, AstNode, SyntaxNodePtr, ast}; |
9 | use ra_arena::{Arena, RawId, ArenaId, impl_arena_id}; | 9 | use ra_arena::{Arena, RawId, ArenaId, impl_arena_id}; |
10 | 10 | ||
@@ -15,14 +15,14 @@ use crate::{ | |||
15 | 15 | ||
16 | #[derive(Debug, Default)] | 16 | #[derive(Debug, Default)] |
17 | pub struct HirInterner { | 17 | pub struct HirInterner { |
18 | macros: LocationIntener<MacroCallLoc, MacroCallId>, | 18 | macros: LocationInterner<MacroCallLoc, MacroCallId>, |
19 | fns: LocationIntener<ItemLoc<ast::FnDef>, FunctionId>, | 19 | fns: LocationInterner<ItemLoc<ast::FnDef>, FunctionId>, |
20 | structs: LocationIntener<ItemLoc<ast::StructDef>, StructId>, | 20 | structs: LocationInterner<ItemLoc<ast::StructDef>, StructId>, |
21 | enums: LocationIntener<ItemLoc<ast::EnumDef>, EnumId>, | 21 | enums: LocationInterner<ItemLoc<ast::EnumDef>, EnumId>, |
22 | consts: LocationIntener<ItemLoc<ast::ConstDef>, ConstId>, | 22 | consts: LocationInterner<ItemLoc<ast::ConstDef>, ConstId>, |
23 | statics: LocationIntener<ItemLoc<ast::StaticDef>, StaticId>, | 23 | statics: LocationInterner<ItemLoc<ast::StaticDef>, StaticId>, |
24 | traits: LocationIntener<ItemLoc<ast::TraitDef>, TraitId>, | 24 | traits: LocationInterner<ItemLoc<ast::TraitDef>, TraitId>, |
25 | types: LocationIntener<ItemLoc<ast::TypeAliasDef>, TypeId>, | 25 | types: LocationInterner<ItemLoc<ast::TypeAliasDef>, TypeId>, |
26 | } | 26 | } |
27 | 27 | ||
28 | impl HirInterner { | 28 | impl HirInterner { |
@@ -204,7 +204,7 @@ impl<'a, DB: PersistentHirDatabase> LocationCtx<&'a DB> { | |||
204 | } | 204 | } |
205 | 205 | ||
206 | pub(crate) trait AstItemDef<N: AstNode>: ArenaId + Clone { | 206 | pub(crate) trait AstItemDef<N: AstNode>: ArenaId + Clone { |
207 | fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<N>, Self>; | 207 | fn interner(interner: &HirInterner) -> &LocationInterner<ItemLoc<N>, Self>; |
208 | fn from_ast(ctx: LocationCtx<&impl PersistentHirDatabase>, ast: &N) -> Self { | 208 | fn from_ast(ctx: LocationCtx<&impl PersistentHirDatabase>, ast: &N) -> Self { |
209 | let items = ctx.db.file_items(ctx.file_id); | 209 | let items = ctx.db.file_items(ctx.file_id); |
210 | let item_id = items.id_of(ctx.file_id, ast.syntax()); | 210 | let item_id = items.id_of(ctx.file_id, ast.syntax()); |
@@ -238,7 +238,7 @@ pub(crate) trait AstItemDef<N: AstNode>: ArenaId + Clone { | |||
238 | pub struct FunctionId(RawId); | 238 | pub struct FunctionId(RawId); |
239 | impl_arena_id!(FunctionId); | 239 | impl_arena_id!(FunctionId); |
240 | impl AstItemDef<ast::FnDef> for FunctionId { | 240 | impl AstItemDef<ast::FnDef> for FunctionId { |
241 | fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<ast::FnDef>, Self> { | 241 | fn interner(interner: &HirInterner) -> &LocationInterner<ItemLoc<ast::FnDef>, Self> { |
242 | &interner.fns | 242 | &interner.fns |
243 | } | 243 | } |
244 | } | 244 | } |
@@ -247,7 +247,7 @@ impl AstItemDef<ast::FnDef> for FunctionId { | |||
247 | pub struct StructId(RawId); | 247 | pub struct StructId(RawId); |
248 | impl_arena_id!(StructId); | 248 | impl_arena_id!(StructId); |
249 | impl AstItemDef<ast::StructDef> for StructId { | 249 | impl AstItemDef<ast::StructDef> for StructId { |
250 | fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<ast::StructDef>, Self> { | 250 | fn interner(interner: &HirInterner) -> &LocationInterner<ItemLoc<ast::StructDef>, Self> { |
251 | &interner.structs | 251 | &interner.structs |
252 | } | 252 | } |
253 | } | 253 | } |
@@ -256,7 +256,7 @@ impl AstItemDef<ast::StructDef> for StructId { | |||
256 | pub struct EnumId(RawId); | 256 | pub struct EnumId(RawId); |
257 | impl_arena_id!(EnumId); | 257 | impl_arena_id!(EnumId); |
258 | impl AstItemDef<ast::EnumDef> for EnumId { | 258 | impl AstItemDef<ast::EnumDef> for EnumId { |
259 | fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<ast::EnumDef>, Self> { | 259 | fn interner(interner: &HirInterner) -> &LocationInterner<ItemLoc<ast::EnumDef>, Self> { |
260 | &interner.enums | 260 | &interner.enums |
261 | } | 261 | } |
262 | } | 262 | } |
@@ -265,7 +265,7 @@ impl AstItemDef<ast::EnumDef> for EnumId { | |||
265 | pub struct ConstId(RawId); | 265 | pub struct ConstId(RawId); |
266 | impl_arena_id!(ConstId); | 266 | impl_arena_id!(ConstId); |
267 | impl AstItemDef<ast::ConstDef> for ConstId { | 267 | impl AstItemDef<ast::ConstDef> for ConstId { |
268 | fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<ast::ConstDef>, Self> { | 268 | fn interner(interner: &HirInterner) -> &LocationInterner<ItemLoc<ast::ConstDef>, Self> { |
269 | &interner.consts | 269 | &interner.consts |
270 | } | 270 | } |
271 | } | 271 | } |
@@ -274,7 +274,7 @@ impl AstItemDef<ast::ConstDef> for ConstId { | |||
274 | pub struct StaticId(RawId); | 274 | pub struct StaticId(RawId); |
275 | impl_arena_id!(StaticId); | 275 | impl_arena_id!(StaticId); |
276 | impl AstItemDef<ast::StaticDef> for StaticId { | 276 | impl AstItemDef<ast::StaticDef> for StaticId { |
277 | fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<ast::StaticDef>, Self> { | 277 | fn interner(interner: &HirInterner) -> &LocationInterner<ItemLoc<ast::StaticDef>, Self> { |
278 | &interner.statics | 278 | &interner.statics |
279 | } | 279 | } |
280 | } | 280 | } |
@@ -283,7 +283,7 @@ impl AstItemDef<ast::StaticDef> for StaticId { | |||
283 | pub struct TraitId(RawId); | 283 | pub struct TraitId(RawId); |
284 | impl_arena_id!(TraitId); | 284 | impl_arena_id!(TraitId); |
285 | impl AstItemDef<ast::TraitDef> for TraitId { | 285 | impl AstItemDef<ast::TraitDef> for TraitId { |
286 | fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<ast::TraitDef>, Self> { | 286 | fn interner(interner: &HirInterner) -> &LocationInterner<ItemLoc<ast::TraitDef>, Self> { |
287 | &interner.traits | 287 | &interner.traits |
288 | } | 288 | } |
289 | } | 289 | } |
@@ -292,7 +292,7 @@ impl AstItemDef<ast::TraitDef> for TraitId { | |||
292 | pub struct TypeId(RawId); | 292 | pub struct TypeId(RawId); |
293 | impl_arena_id!(TypeId); | 293 | impl_arena_id!(TypeId); |
294 | impl AstItemDef<ast::TypeAliasDef> for TypeId { | 294 | impl AstItemDef<ast::TypeAliasDef> for TypeId { |
295 | fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<ast::TypeAliasDef>, Self> { | 295 | fn interner(interner: &HirInterner) -> &LocationInterner<ItemLoc<ast::TypeAliasDef>, Self> { |
296 | &interner.types | 296 | &interner.types |
297 | } | 297 | } |
298 | } | 298 | } |