@@ -976,6 +976,40 @@ fn should_encode_fn_sig(def_kind: DefKind) -> bool {
976976 }
977977}
978978
979+ fn should_encode_explicit_item_bounds ( def_kind : DefKind ) -> bool {
980+ match def_kind {
981+ DefKind :: AssocTy | DefKind :: OpaqueTy => true ,
982+ DefKind :: Variant
983+ | DefKind :: TraitAlias
984+ | DefKind :: Fn
985+ | DefKind :: Ctor ( ..)
986+ | DefKind :: AssocFn
987+ | DefKind :: Struct
988+ | DefKind :: Union
989+ | DefKind :: Enum
990+ | DefKind :: Trait
991+ | DefKind :: TyAlias
992+ | DefKind :: ForeignTy
993+ | DefKind :: Const
994+ | DefKind :: Static
995+ | DefKind :: AssocConst
996+ | DefKind :: AnonConst
997+ | DefKind :: Impl
998+ | DefKind :: Closure
999+ | DefKind :: Generator
1000+ | DefKind :: Mod
1001+ | DefKind :: Field
1002+ | DefKind :: ForeignMod
1003+ | DefKind :: TyParam
1004+ | DefKind :: ConstParam
1005+ | DefKind :: Macro ( ..)
1006+ | DefKind :: Use
1007+ | DefKind :: LifetimeParam
1008+ | DefKind :: GlobalAsm
1009+ | DefKind :: ExternCrate => false ,
1010+ }
1011+ }
1012+
9791013impl EncodeContext < ' a , ' tcx > {
9801014 fn encode_def_ids ( & mut self ) {
9811015 if self . is_proc_macro {
@@ -1030,7 +1064,12 @@ impl EncodeContext<'a, 'tcx> {
10301064 record ! ( self . tables. fn_sig[ def_id] <- sig) ;
10311065 }
10321066 }
1033- self . encode_explicit_item_bounds ( def_id) ;
1067+ if should_encode_explicit_item_bounds ( def_kind) {
1068+ let bounds = self . tcx . explicit_item_bounds ( def_id) ;
1069+ if !bounds. is_empty ( ) {
1070+ record ! ( self . tables. explicit_item_bounds[ def_id] <- bounds) ;
1071+ }
1072+ }
10341073 }
10351074 let inherent_impls = tcx. crate_inherent_impls ( LOCAL_CRATE ) ;
10361075 for ( def_id, implementations) in inherent_impls. inherent_impls . iter ( ) {
@@ -1152,14 +1191,6 @@ impl EncodeContext<'a, 'tcx> {
11521191 record ! ( self . tables. kind[ def_id] <- EntryKind :: Struct ( self . lazy( data) , adt_def. repr) ) ;
11531192 }
11541193
1155- fn encode_explicit_item_bounds ( & mut self , def_id : DefId ) {
1156- debug ! ( "EncodeContext::encode_explicit_item_bounds({:?})" , def_id) ;
1157- let bounds = self . tcx . explicit_item_bounds ( def_id) ;
1158- if !bounds. is_empty ( ) {
1159- record ! ( self . tables. explicit_item_bounds[ def_id] <- bounds) ;
1160- }
1161- }
1162-
11631194 fn encode_info_for_trait_item ( & mut self , def_id : DefId ) {
11641195 debug ! ( "EncodeContext::encode_info_for_trait_item({:?})" , def_id) ;
11651196 let tcx = self . tcx ;
0 commit comments