File tree Expand file tree Collapse file tree 1 file changed +20
-17
lines changed
compiler/rustc_metadata/src/rmeta Expand file tree Collapse file tree 1 file changed +20
-17
lines changed Original file line number Diff line number Diff line change @@ -1061,25 +1061,14 @@ fn should_encode_const(def_kind: DefKind) -> bool {
10611061
10621062fn should_encode_constness ( def_kind : DefKind ) -> bool {
10631063 match def_kind {
1064- DefKind :: Struct
1065- | DefKind :: Union
1066- | DefKind :: Enum
1067- | DefKind :: Trait
1068- | DefKind :: AssocTy
1069- | DefKind :: Fn
1070- | DefKind :: Const
1071- | DefKind :: Static ( ..)
1072- | DefKind :: Ctor ( ..)
1064+ DefKind :: Fn
10731065 | DefKind :: AssocFn
1074- | DefKind :: AssocConst
1075- | DefKind :: AnonConst
1076- | DefKind :: InlineConst
1077- | DefKind :: OpaqueTy
1078- | DefKind :: ImplTraitPlaceholder
1066+ | DefKind :: AssocTy
1067+ | DefKind :: Trait
10791068 | DefKind :: Impl
10801069 | DefKind :: Closure
1081- | DefKind :: Generator
1082- | DefKind :: TyAlias => true ,
1070+ | DefKind :: Generator => true ,
1071+ // It doesn't make sense to compute constness on these DefKinds
10831072 DefKind :: Variant
10841073 | DefKind :: TraitAlias
10851074 | DefKind :: ForeignTy
@@ -1092,7 +1081,21 @@ fn should_encode_constness(def_kind: DefKind) -> bool {
10921081 | DefKind :: Use
10931082 | DefKind :: LifetimeParam
10941083 | DefKind :: GlobalAsm
1095- | DefKind :: ExternCrate => false ,
1084+ | DefKind :: ExternCrate
1085+ // These items are not conditionally const,
1086+ // and therefore don't need their constness stored.
1087+ | DefKind :: Struct
1088+ | DefKind :: Union
1089+ | DefKind :: Enum
1090+ | DefKind :: TyAlias
1091+ | DefKind :: OpaqueTy
1092+ | DefKind :: ImplTraitPlaceholder
1093+ | DefKind :: Const
1094+ | DefKind :: Static ( _)
1095+ | DefKind :: Ctor ( _, _)
1096+ | DefKind :: AssocConst
1097+ | DefKind :: AnonConst
1098+ | DefKind :: InlineConst => false ,
10961099 }
10971100}
10981101
You can’t perform that action at this time.
0 commit comments