@@ -86,7 +86,7 @@ use crate::{
86
86
builtin_type:: BuiltinType ,
87
87
item_tree:: {
88
88
Const , Enum , Function , Impl , ItemTreeId , ItemTreeNode , MacroDef , MacroRules , ModItem ,
89
- Static , Struct , Trait , TypeAlias , Union ,
89
+ Static , Struct , Trait , TraitAlias , TypeAlias , Union ,
90
90
} ,
91
91
} ;
92
92
@@ -261,6 +261,11 @@ pub struct TraitId(salsa::InternId);
261
261
pub type TraitLoc = ItemLoc < Trait > ;
262
262
impl_intern ! ( TraitId , TraitLoc , intern_trait, lookup_intern_trait) ;
263
263
264
+ #[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
265
+ pub struct TraitAliasId ( salsa:: InternId ) ;
266
+ pub type TraitAliasLoc = ItemLoc < TraitAlias > ;
267
+ impl_intern ! ( TraitAliasId , TraitAliasLoc , intern_trait_alias, lookup_intern_trait_alias) ;
268
+
264
269
#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
265
270
pub struct TypeAliasId ( salsa:: InternId ) ;
266
271
type TypeAliasLoc = AssocItemLoc < TypeAlias > ;
@@ -453,6 +458,7 @@ pub enum ModuleDefId {
453
458
ConstId ( ConstId ) ,
454
459
StaticId ( StaticId ) ,
455
460
TraitId ( TraitId ) ,
461
+ TraitAliasId ( TraitAliasId ) ,
456
462
TypeAliasId ( TypeAliasId ) ,
457
463
BuiltinType ( BuiltinType ) ,
458
464
MacroId ( MacroId ) ,
@@ -466,6 +472,7 @@ impl_from!(
466
472
ConstId ,
467
473
StaticId ,
468
474
TraitId ,
475
+ TraitAliasId ,
469
476
TypeAliasId ,
470
477
BuiltinType
471
478
for ModuleDefId
@@ -516,6 +523,7 @@ pub enum GenericDefId {
516
523
FunctionId ( FunctionId ) ,
517
524
AdtId ( AdtId ) ,
518
525
TraitId ( TraitId ) ,
526
+ TraitAliasId ( TraitAliasId ) ,
519
527
TypeAliasId ( TypeAliasId ) ,
520
528
ImplId ( ImplId ) ,
521
529
// enum variants cannot have generics themselves, but their parent enums
@@ -528,6 +536,7 @@ impl_from!(
528
536
FunctionId ,
529
537
AdtId ( StructId , EnumId , UnionId ) ,
530
538
TraitId ,
539
+ TraitAliasId ,
531
540
TypeAliasId ,
532
541
ImplId ,
533
542
EnumVariantId ,
@@ -555,6 +564,7 @@ pub enum AttrDefId {
555
564
StaticId ( StaticId ) ,
556
565
ConstId ( ConstId ) ,
557
566
TraitId ( TraitId ) ,
567
+ TraitAliasId ( TraitAliasId ) ,
558
568
TypeAliasId ( TypeAliasId ) ,
559
569
MacroId ( MacroId ) ,
560
570
ImplId ( ImplId ) ,
@@ -714,6 +724,7 @@ impl HasModule for GenericDefId {
714
724
GenericDefId :: FunctionId ( it) => it. lookup ( db) . module ( db) ,
715
725
GenericDefId :: AdtId ( it) => it. module ( db) ,
716
726
GenericDefId :: TraitId ( it) => it. lookup ( db) . container ,
727
+ GenericDefId :: TraitAliasId ( it) => it. lookup ( db) . container ,
717
728
GenericDefId :: TypeAliasId ( it) => it. lookup ( db) . module ( db) ,
718
729
GenericDefId :: ImplId ( it) => it. lookup ( db) . container ,
719
730
GenericDefId :: EnumVariantId ( it) => it. parent . lookup ( db) . container ,
@@ -747,6 +758,7 @@ impl ModuleDefId {
747
758
ModuleDefId :: ConstId ( id) => id. lookup ( db) . container . module ( db) ,
748
759
ModuleDefId :: StaticId ( id) => id. lookup ( db) . module ( db) ,
749
760
ModuleDefId :: TraitId ( id) => id. lookup ( db) . container ,
761
+ ModuleDefId :: TraitAliasId ( id) => id. lookup ( db) . container ,
750
762
ModuleDefId :: TypeAliasId ( id) => id. lookup ( db) . module ( db) ,
751
763
ModuleDefId :: MacroId ( id) => id. module ( db) ,
752
764
ModuleDefId :: BuiltinType ( _) => return None ,
@@ -765,6 +777,7 @@ impl AttrDefId {
765
777
AttrDefId :: StaticId ( it) => it. lookup ( db) . module ( db) . krate ,
766
778
AttrDefId :: ConstId ( it) => it. lookup ( db) . module ( db) . krate ,
767
779
AttrDefId :: TraitId ( it) => it. lookup ( db) . container . krate ,
780
+ AttrDefId :: TraitAliasId ( it) => it. lookup ( db) . container . krate ,
768
781
AttrDefId :: TypeAliasId ( it) => it. lookup ( db) . module ( db) . krate ,
769
782
AttrDefId :: ImplId ( it) => it. lookup ( db) . container . krate ,
770
783
AttrDefId :: ExternBlockId ( it) => it. lookup ( db) . container . krate ,
0 commit comments