@@ -76,6 +76,7 @@ struct PerDefTables<'tcx> {
7676 generics : PerDefTable < Lazy < ty:: Generics > > ,
7777 predicates : PerDefTable < Lazy < ty:: GenericPredicates < ' tcx > > > ,
7878 predicates_defined_on : PerDefTable < Lazy < ty:: GenericPredicates < ' tcx > > > ,
79+ super_predicates : PerDefTable < Lazy < ty:: GenericPredicates < ' tcx > > > ,
7980
8081 mir : PerDefTable < Lazy < mir:: Body < ' tcx > > > ,
8182 promoted_mir : PerDefTable < Lazy < IndexVec < mir:: Promoted , mir:: Body < ' tcx > > > > ,
@@ -513,6 +514,7 @@ impl<'tcx> EncodeContext<'tcx> {
513514 generics : self . per_def . generics . encode ( & mut self . opaque ) ,
514515 predicates : self . per_def . predicates . encode ( & mut self . opaque ) ,
515516 predicates_defined_on : self . per_def . predicates_defined_on . encode ( & mut self . opaque ) ,
517+ super_predicates : self . per_def . super_predicates . encode ( & mut self . opaque ) ,
516518
517519 mir : self . per_def . mir . encode ( & mut self . opaque ) ,
518520 promoted_mir : self . per_def . promoted_mir . encode ( & mut self . opaque ) ,
@@ -835,6 +837,11 @@ impl EncodeContext<'tcx> {
835837 self . tcx. predicates_defined_on( def_id) )
836838 }
837839
840+ fn encode_super_predicates ( & mut self , def_id : DefId ) {
841+ debug ! ( "EncodeContext::encode_super_predicates({:?})" , def_id) ;
842+ record ! ( self . per_def. super_predicates[ def_id] <- self . tcx. super_predicates_of( def_id) ) ;
843+ }
844+
838845 fn encode_info_for_trait_item ( & mut self , def_id : DefId ) {
839846 debug ! ( "EncodeContext::encode_info_for_trait_item({:?})" , def_id) ;
840847 let tcx = self . tcx ;
@@ -1166,18 +1173,11 @@ impl EncodeContext<'tcx> {
11661173 paren_sugar: trait_def. paren_sugar,
11671174 has_auto_impl: self . tcx. trait_is_auto( def_id) ,
11681175 is_marker: trait_def. is_marker,
1169- super_predicates: self . lazy( tcx. super_predicates_of( def_id) ) ,
11701176 } ;
11711177
11721178 EntryKind :: Trait ( self . lazy( data) )
11731179 }
1174- hir:: ItemKind :: TraitAlias ( ..) => {
1175- let data = TraitAliasData {
1176- super_predicates: self . lazy( tcx. super_predicates_of( def_id) ) ,
1177- } ;
1178-
1179- EntryKind :: TraitAlias ( self . lazy( data) )
1180- }
1180+ hir:: ItemKind :: TraitAlias ( ..) => EntryKind :: TraitAlias ,
11811181 hir:: ItemKind :: ExternCrate ( _) |
11821182 hir:: ItemKind :: Use ( ..) => bug!( "cannot encode info for item {:?}" , item) ,
11831183 } ) ;
@@ -1269,6 +1269,13 @@ impl EncodeContext<'tcx> {
12691269 }
12701270 _ => { } // not *wrong* for other kinds of items, but not needed
12711271 }
1272+ match item. kind {
1273+ hir:: ItemKind :: Trait ( ..) |
1274+ hir:: ItemKind :: TraitAlias ( ..) => {
1275+ self . encode_super_predicates ( def_id) ;
1276+ }
1277+ _ => { }
1278+ }
12721279
12731280 let mir = match item. kind {
12741281 hir:: ItemKind :: Static ( ..) | hir:: ItemKind :: Const ( ..) => true ,
0 commit comments