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 {
750
750
}
751
751
}
752
752
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
+
753
788
impl EncodeContext < ' a , ' tcx > {
754
789
fn encode_def_ids ( & mut self ) {
755
790
if self . is_proc_macro {
@@ -773,9 +808,11 @@ impl EncodeContext<'a, 'tcx> {
773
808
if should_encode_visibility ( def_kind) {
774
809
record ! ( self . tables. visibility[ def_id] <- self . tcx. visibility( def_id) ) ;
775
810
}
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
+ }
779
816
}
780
817
}
781
818
You can’t perform that action at this time.
0 commit comments