File tree 1 file changed +20
-17
lines changed
compiler/rustc_metadata/src/rmeta
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 {
1061
1061
1062
1062
fn should_encode_constness ( def_kind : DefKind ) -> bool {
1063
1063
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
1073
1065
| DefKind :: AssocFn
1074
- | DefKind :: AssocConst
1075
- | DefKind :: AnonConst
1076
- | DefKind :: InlineConst
1077
- | DefKind :: OpaqueTy
1078
- | DefKind :: ImplTraitPlaceholder
1066
+ | DefKind :: AssocTy
1067
+ | DefKind :: Trait
1079
1068
| DefKind :: Impl
1080
1069
| 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
1083
1072
DefKind :: Variant
1084
1073
| DefKind :: TraitAlias
1085
1074
| DefKind :: ForeignTy
@@ -1092,7 +1081,21 @@ fn should_encode_constness(def_kind: DefKind) -> bool {
1092
1081
| DefKind :: Use
1093
1082
| DefKind :: LifetimeParam
1094
1083
| 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 ,
1096
1099
}
1097
1100
}
1098
1101
You can’t perform that action at this time.
0 commit comments