@@ -418,6 +418,7 @@ impl<'tcx> EntryKind<'tcx> {
418418 EntryKind :: Mod ( _) => Def :: Mod ( did) ,
419419 EntryKind :: Variant ( _) => Def :: Variant ( did) ,
420420 EntryKind :: Trait ( _) => Def :: Trait ( did) ,
421+ EntryKind :: TraitAlias ( _) => Def :: TraitAlias ( did) ,
421422 EntryKind :: Enum ( ..) => Def :: Enum ( did) ,
422423 EntryKind :: MacroDef ( _) => Def :: Macro ( did, MacroKind :: Bang ) ,
423424 EntryKind :: ForeignType => Def :: ForeignTy ( did) ,
@@ -520,17 +521,26 @@ impl<'a, 'tcx> CrateMetadata {
520521 }
521522
522523 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+ }
534544 }
535545
536546 fn get_variant ( & self ,
@@ -615,10 +625,13 @@ impl<'a, 'tcx> CrateMetadata {
615625 item_id : DefIndex ,
616626 tcx : TyCtxt < ' a , ' tcx , ' tcx > )
617627 -> 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) )
622635 }
623636
624637 pub fn get_generics ( & self ,
@@ -1014,7 +1027,8 @@ impl<'a, 'tcx> CrateMetadata {
10141027 }
10151028 def_key. parent . and_then ( |parent_index| {
10161029 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) ) ,
10181032 _ => None ,
10191033 }
10201034 } )
0 commit comments