@@ -418,6 +418,7 @@ impl<'tcx> EntryKind<'tcx> {
418
418
EntryKind :: Mod ( _) => Def :: Mod ( did) ,
419
419
EntryKind :: Variant ( _) => Def :: Variant ( did) ,
420
420
EntryKind :: Trait ( _) => Def :: Trait ( did) ,
421
+ EntryKind :: TraitAlias ( _) => Def :: TraitAlias ( did) ,
421
422
EntryKind :: Enum ( ..) => Def :: Enum ( did) ,
422
423
EntryKind :: MacroDef ( _) => Def :: Macro ( did, MacroKind :: Bang ) ,
423
424
EntryKind :: ForeignType => Def :: ForeignTy ( did) ,
@@ -520,17 +521,26 @@ impl<'a, 'tcx> CrateMetadata {
520
521
}
521
522
522
523
pub fn get_trait_def ( & self , item_id : DefIndex , sess : & Session ) -> ty:: TraitDef {
523
- let data = match self . entry ( item_id) . kind {
524
- EntryKind :: Trait ( data) => data. decode ( ( self , sess) ) ,
525
- _ => bug ! ( ) ,
526
- } ;
527
-
528
- ty:: TraitDef :: new ( self . local_def_id ( item_id) ,
529
- data. unsafety ,
530
- data. paren_sugar ,
531
- data. has_auto_impl ,
532
- data. is_marker ,
533
- self . def_path_table . def_path_hash ( item_id) )
524
+ match self . entry ( item_id) . kind {
525
+ EntryKind :: Trait ( data) => {
526
+ let data = data. decode ( ( self , sess) ) ;
527
+ ty:: TraitDef :: new ( self . local_def_id ( item_id) ,
528
+ data. unsafety ,
529
+ data. paren_sugar ,
530
+ data. has_auto_impl ,
531
+ data. is_marker ,
532
+ self . def_path_table . def_path_hash ( item_id) )
533
+ } ,
534
+ EntryKind :: TraitAlias ( _) => {
535
+ ty:: TraitDef :: new ( self . local_def_id ( item_id) ,
536
+ hir:: Unsafety :: Normal ,
537
+ false ,
538
+ false ,
539
+ false ,
540
+ self . def_path_table . def_path_hash ( item_id) )
541
+ } ,
542
+ _ => bug ! ( "def-index does not refer to trait or trait alias" ) ,
543
+ }
534
544
}
535
545
536
546
fn get_variant ( & self ,
@@ -615,10 +625,13 @@ impl<'a, 'tcx> CrateMetadata {
615
625
item_id : DefIndex ,
616
626
tcx : TyCtxt < ' a , ' tcx , ' tcx > )
617
627
-> ty:: GenericPredicates < ' tcx > {
618
- match self . entry ( item_id) . kind {
619
- EntryKind :: Trait ( data) => data. decode ( self ) . super_predicates . decode ( ( self , tcx) ) ,
620
- _ => bug ! ( ) ,
621
- }
628
+ let super_predicates = match self . entry ( item_id) . kind {
629
+ EntryKind :: Trait ( data) => data. decode ( self ) . super_predicates ,
630
+ EntryKind :: TraitAlias ( data) => data. decode ( self ) . super_predicates ,
631
+ _ => bug ! ( "def-index does not refer to trait or trait alias" ) ,
632
+ } ;
633
+
634
+ super_predicates. decode ( ( self , tcx) )
622
635
}
623
636
624
637
pub fn get_generics ( & self ,
@@ -1014,7 +1027,8 @@ impl<'a, 'tcx> CrateMetadata {
1014
1027
}
1015
1028
def_key. parent . and_then ( |parent_index| {
1016
1029
match self . entry ( parent_index) . kind {
1017
- EntryKind :: Trait ( _) => Some ( self . local_def_id ( parent_index) ) ,
1030
+ EntryKind :: Trait ( _) |
1031
+ EntryKind :: TraitAlias ( _) => Some ( self . local_def_id ( parent_index) ) ,
1018
1032
_ => None ,
1019
1033
}
1020
1034
} )
0 commit comments