@@ -76,6 +76,7 @@ struct PerDefTables<'tcx> {
76
76
generics : PerDefTable < Lazy < ty:: Generics > > ,
77
77
predicates : PerDefTable < Lazy < ty:: GenericPredicates < ' tcx > > > ,
78
78
predicates_defined_on : PerDefTable < Lazy < ty:: GenericPredicates < ' tcx > > > ,
79
+ super_predicates : PerDefTable < Lazy < ty:: GenericPredicates < ' tcx > > > ,
79
80
80
81
mir : PerDefTable < Lazy < mir:: Body < ' tcx > > > ,
81
82
promoted_mir : PerDefTable < Lazy < IndexVec < mir:: Promoted , mir:: Body < ' tcx > > > > ,
@@ -513,6 +514,7 @@ impl<'tcx> EncodeContext<'tcx> {
513
514
generics : self . per_def . generics . encode ( & mut self . opaque ) ,
514
515
predicates : self . per_def . predicates . encode ( & mut self . opaque ) ,
515
516
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 ) ,
516
518
517
519
mir : self . per_def . mir . encode ( & mut self . opaque ) ,
518
520
promoted_mir : self . per_def . promoted_mir . encode ( & mut self . opaque ) ,
@@ -835,6 +837,11 @@ impl EncodeContext<'tcx> {
835
837
self . tcx. predicates_defined_on( def_id) )
836
838
}
837
839
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
+
838
845
fn encode_info_for_trait_item ( & mut self , def_id : DefId ) {
839
846
debug ! ( "EncodeContext::encode_info_for_trait_item({:?})" , def_id) ;
840
847
let tcx = self . tcx ;
@@ -1166,18 +1173,11 @@ impl EncodeContext<'tcx> {
1166
1173
paren_sugar: trait_def. paren_sugar,
1167
1174
has_auto_impl: self . tcx. trait_is_auto( def_id) ,
1168
1175
is_marker: trait_def. is_marker,
1169
- super_predicates: self . lazy( tcx. super_predicates_of( def_id) ) ,
1170
1176
} ;
1171
1177
1172
1178
EntryKind :: Trait ( self . lazy( data) )
1173
1179
}
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 ,
1181
1181
hir:: ItemKind :: ExternCrate ( _) |
1182
1182
hir:: ItemKind :: Use ( ..) => bug!( "cannot encode info for item {:?}" , item) ,
1183
1183
} ) ;
@@ -1269,6 +1269,13 @@ impl EncodeContext<'tcx> {
1269
1269
}
1270
1270
_ => { } // not *wrong* for other kinds of items, but not needed
1271
1271
}
1272
+ match item. kind {
1273
+ hir:: ItemKind :: Trait ( ..) |
1274
+ hir:: ItemKind :: TraitAlias ( ..) => {
1275
+ self . encode_super_predicates ( def_id) ;
1276
+ }
1277
+ _ => { }
1278
+ }
1272
1279
1273
1280
let mir = match item. kind {
1274
1281
hir:: ItemKind :: Static ( ..) | hir:: ItemKind :: Const ( ..) => true ,
0 commit comments