This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +40
-3
lines changed
compiler/rustc_metadata/src/rmeta Expand file tree Collapse file tree 1 file changed +40
-3
lines changed Original file line number Diff line number Diff line change @@ -750,6 +750,41 @@ fn should_encode_visibility(def_kind: DefKind) -> bool {
750750 }
751751}
752752
753+ fn should_encode_stability ( def_kind : DefKind ) -> bool {
754+ match def_kind {
755+ DefKind :: Mod
756+ | DefKind :: Ctor ( ..)
757+ | DefKind :: Variant
758+ | DefKind :: Field
759+ | DefKind :: Struct
760+ | DefKind :: AssocTy
761+ | DefKind :: AssocFn
762+ | DefKind :: AssocConst
763+ | DefKind :: TyParam
764+ | DefKind :: ConstParam
765+ | DefKind :: Static
766+ | DefKind :: Const
767+ | DefKind :: Fn
768+ | DefKind :: ForeignMod
769+ | DefKind :: TyAlias
770+ | DefKind :: OpaqueTy
771+ | DefKind :: Enum
772+ | DefKind :: Union
773+ | DefKind :: Impl
774+ | DefKind :: Trait
775+ | DefKind :: TraitAlias
776+ | DefKind :: Macro ( ..)
777+ | DefKind :: ForeignTy => true ,
778+ DefKind :: Use
779+ | DefKind :: LifetimeParam
780+ | DefKind :: AnonConst
781+ | DefKind :: GlobalAsm
782+ | DefKind :: Closure
783+ | DefKind :: Generator
784+ | DefKind :: ExternCrate => false ,
785+ }
786+ }
787+
753788impl EncodeContext < ' a , ' tcx > {
754789 fn encode_def_ids ( & mut self ) {
755790 if self . is_proc_macro {
@@ -773,9 +808,11 @@ impl EncodeContext<'a, 'tcx> {
773808 if should_encode_visibility ( def_kind) {
774809 record ! ( self . tables. visibility[ def_id] <- self . tcx. visibility( def_id) ) ;
775810 }
776- self . encode_stability ( def_id) ;
777- self . encode_const_stability ( def_id) ;
778- self . encode_deprecation ( def_id) ;
811+ if should_encode_stability ( def_kind) {
812+ self . encode_stability ( def_id) ;
813+ self . encode_const_stability ( def_id) ;
814+ self . encode_deprecation ( def_id) ;
815+ }
779816 }
780817 }
781818
You can’t perform that action at this time.
0 commit comments