@@ -976,6 +976,40 @@ fn should_encode_fn_sig(def_kind: DefKind) -> bool {
976
976
}
977
977
}
978
978
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
+
979
1013
impl EncodeContext < ' a , ' tcx > {
980
1014
fn encode_def_ids ( & mut self ) {
981
1015
if self . is_proc_macro {
@@ -1030,7 +1064,12 @@ impl EncodeContext<'a, 'tcx> {
1030
1064
record ! ( self . tables. fn_sig[ def_id] <- sig) ;
1031
1065
}
1032
1066
}
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
+ }
1034
1073
}
1035
1074
let inherent_impls = tcx. crate_inherent_impls ( LOCAL_CRATE ) ;
1036
1075
for ( def_id, implementations) in inherent_impls. inherent_impls . iter ( ) {
@@ -1152,14 +1191,6 @@ impl EncodeContext<'a, 'tcx> {
1152
1191
record ! ( self . tables. kind[ def_id] <- EntryKind :: Struct ( self . lazy( data) , adt_def. repr) ) ;
1153
1192
}
1154
1193
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
-
1163
1194
fn encode_info_for_trait_item ( & mut self , def_id : DefId ) {
1164
1195
debug ! ( "EncodeContext::encode_info_for_trait_item({:?})" , def_id) ;
1165
1196
let tcx = self . tcx ;
0 commit comments