diff options
author | Aleksey Kladov <[email protected]> | 2019-11-23 08:14:10 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-11-23 08:14:40 +0000 |
commit | 552ba868afc8f72202ac834d07bbeb330aca007d (patch) | |
tree | cd57fc21ce442e84bdc41241a70ece9995d826af /crates/ra_hir_def/src/lib.rs | |
parent | 81bfbd26bef1a63ccbeba33430e6b07a53c8e7d9 (diff) |
Move attrs query to hir_def
Diffstat (limited to 'crates/ra_hir_def/src/lib.rs')
-rw-r--r-- | crates/ra_hir_def/src/lib.rs | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs index 2edf743ab..1bcdf9b78 100644 --- a/crates/ra_hir_def/src/lib.rs +++ b/crates/ra_hir_def/src/lib.rs | |||
@@ -32,7 +32,7 @@ pub mod nameres; | |||
32 | 32 | ||
33 | use std::hash::{Hash, Hasher}; | 33 | use std::hash::{Hash, Hasher}; |
34 | 34 | ||
35 | use hir_expand::{ast_id_map::FileAstId, db::AstDatabase, AstId, HirFileId, Source}; | 35 | use hir_expand::{ast_id_map::FileAstId, db::AstDatabase, AstId, HirFileId, MacroDefId, Source}; |
36 | use ra_arena::{impl_arena_id, map::ArenaMap, RawId}; | 36 | use ra_arena::{impl_arena_id, map::ArenaMap, RawId}; |
37 | use ra_db::{salsa, CrateId, FileId}; | 37 | use ra_db::{salsa, CrateId, FileId}; |
38 | use ra_syntax::{ast, AstNode, SyntaxNode}; | 38 | use ra_syntax::{ast, AstNode, SyntaxNode}; |
@@ -280,8 +280,8 @@ pub enum VariantId { | |||
280 | 280 | ||
281 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 281 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
282 | pub struct StructFieldId { | 282 | pub struct StructFieldId { |
283 | parent: VariantId, | 283 | pub parent: VariantId, |
284 | local_id: LocalStructFieldId, | 284 | pub local_id: LocalStructFieldId, |
285 | } | 285 | } |
286 | 286 | ||
287 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 287 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
@@ -477,6 +477,33 @@ impl_froms!( | |||
477 | ConstId | 477 | ConstId |
478 | ); | 478 | ); |
479 | 479 | ||
480 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] | ||
481 | pub enum AttrDefId { | ||
482 | ModuleId(ModuleId), | ||
483 | StructFieldId(StructFieldId), | ||
484 | AdtId(AdtId), | ||
485 | FunctionId(FunctionId), | ||
486 | EnumVariantId(EnumVariantId), | ||
487 | StaticId(StaticId), | ||
488 | ConstId(ConstId), | ||
489 | TraitId(TraitId), | ||
490 | TypeAliasId(TypeAliasId), | ||
491 | MacroDefId(MacroDefId), | ||
492 | } | ||
493 | |||
494 | impl_froms!( | ||
495 | AttrDefId: ModuleId, | ||
496 | StructFieldId, | ||
497 | AdtId(StructId, EnumId, UnionId), | ||
498 | EnumVariantId, | ||
499 | StaticId, | ||
500 | ConstId, | ||
501 | FunctionId, | ||
502 | TraitId, | ||
503 | TypeAliasId, | ||
504 | MacroDefId | ||
505 | ); | ||
506 | |||
480 | trait Intern { | 507 | trait Intern { |
481 | type ID; | 508 | type ID; |
482 | fn intern(self, db: &impl db::DefDatabase2) -> Self::ID; | 509 | fn intern(self, db: &impl db::DefDatabase2) -> Self::ID; |