File tree Expand file tree Collapse file tree 1 file changed +39
-2
lines changed
compiler/rustc_metadata/src/rmeta Expand file tree Collapse file tree 1 file changed +39
-2
lines changed Original file line number Diff line number Diff line change @@ -906,6 +906,41 @@ fn should_encode_generics(def_kind: DefKind) -> bool {
906
906
}
907
907
}
908
908
909
+ fn should_encode_type ( def_kind : DefKind ) -> bool {
910
+ match def_kind {
911
+ DefKind :: Struct
912
+ | DefKind :: Union
913
+ | DefKind :: Enum
914
+ | DefKind :: Variant
915
+ | DefKind :: TyAlias
916
+ | DefKind :: ForeignTy
917
+ | DefKind :: AssocTy
918
+ | DefKind :: TyParam
919
+ | DefKind :: Fn
920
+ | DefKind :: Const
921
+ | DefKind :: ConstParam
922
+ | DefKind :: Static
923
+ | DefKind :: Ctor ( ..)
924
+ | DefKind :: AssocFn
925
+ | DefKind :: AssocConst
926
+ | DefKind :: AnonConst
927
+ | DefKind :: OpaqueTy
928
+ | DefKind :: Field
929
+ | DefKind :: Impl
930
+ | DefKind :: Closure
931
+ | DefKind :: Generator => true ,
932
+ DefKind :: Mod
933
+ | DefKind :: ForeignMod
934
+ | DefKind :: Trait
935
+ | DefKind :: TraitAlias
936
+ | DefKind :: Macro ( ..)
937
+ | DefKind :: Use
938
+ | DefKind :: LifetimeParam
939
+ | DefKind :: GlobalAsm
940
+ | DefKind :: ExternCrate => false ,
941
+ }
942
+ }
943
+
909
944
impl EncodeContext < ' a , ' tcx > {
910
945
fn encode_def_ids ( & mut self ) {
911
946
if self . is_proc_macro {
@@ -950,8 +985,10 @@ impl EncodeContext<'a, 'tcx> {
950
985
if let DefKind :: Trait | DefKind :: TraitAlias = def_kind {
951
986
record ! ( self . tables. super_predicates[ def_id] <- self . tcx. super_predicates_of( def_id) ) ;
952
987
}
953
- if let Ok ( ty) = self . tcx . try_type_of ( def_id) {
954
- record ! ( self . tables. ty[ def_id] <- ty) ;
988
+ if should_encode_type ( def_kind) {
989
+ if let Ok ( ty) = self . tcx . try_type_of ( def_id) {
990
+ record ! ( self . tables. ty[ def_id] <- ty) ;
991
+ }
955
992
}
956
993
}
957
994
let inherent_impls = tcx. crate_inherent_impls ( LOCAL_CRATE ) ;
You can’t perform that action at this time.
0 commit comments