Skip to content

Commit dc62b8f

Browse files
committed
replaces few consts with statics to reduce readonly section
1 parent 633a3fe commit dc62b8f

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

compiler/rustc_feature/src/accepted.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ macro_rules! declare_features {
99
$(#[doc = $doc:tt])* (accepted, $feature:ident, $ver:expr, $issue:expr),
1010
)+) => {
1111
/// Formerly unstable features that have now been accepted (stabilized).
12-
pub const ACCEPTED_LANG_FEATURES: &[Feature] = &[
12+
pub static ACCEPTED_LANG_FEATURES: &[Feature] = &[
1313
$(Feature {
1414
name: sym::$feature,
1515
since: $ver,

compiler/rustc_feature/src/builtin_attrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ pub struct BuiltinAttribute {
317317

318318
/// Attributes that have a special meaning to rustc or rustdoc.
319319
#[rustfmt::skip]
320-
pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
320+
pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
321321
// ==========================================================================
322322
// Stable attributes:
323323
// ==========================================================================

compiler/rustc_feature/src/removed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ macro_rules! declare_features {
1414
$(#[doc = $doc:tt])* (removed, $feature:ident, $ver:expr, $issue:expr, $reason:expr),
1515
)+) => {
1616
/// Formerly unstable features that have now been removed.
17-
pub const REMOVED_LANG_FEATURES: &[RemovedFeature] = &[
17+
pub static REMOVED_LANG_FEATURES: &[RemovedFeature] = &[
1818
$(RemovedFeature {
1919
feature: Feature {
2020
name: sym::$feature,

compiler/rustc_feature/src/unstable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ macro_rules! declare_features {
104104
)+) => {
105105
/// Unstable language features that are being implemented or being
106106
/// considered for acceptance (stabilization) or removal.
107-
pub const UNSTABLE_LANG_FEATURES: &[Feature] = &[
107+
pub static UNSTABLE_LANG_FEATURES: &[Feature] = &[
108108
$(Feature {
109109
name: sym::$feature,
110110
since: $ver,

compiler/rustc_parse/src/lexer/unicode_chars.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::errors::TokenSubstitution;
88
use crate::token::{self, Delimiter};
99

1010
#[rustfmt::skip] // for line breaks
11-
pub(super) const UNICODE_ARRAY: &[(char, &str, &str)] = &[
11+
pub(super) static UNICODE_ARRAY: &[(char, &str, &str)] = &[
1212
('
', "Line Separator", " "),
1313
('
', "Paragraph Separator", " "),
1414
(' ', "Ogham Space mark", " "),

compiler/rustc_target/src/spec/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1624,7 +1624,7 @@ macro_rules! supported_targets {
16241624
}
16251625

16261626
/// List of supported targets
1627-
pub const TARGETS: &[&str] = &[$($tuple),+];
1627+
pub static TARGETS: &[&str] = &[$($tuple),+];
16281628

16291629
fn load_builtin(target: &str) -> Option<Target> {
16301630
let t = match target {

compiler/rustc_target/src/target_features.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl Stability {
133133
// Both of these are also applied transitively.
134134
type ImpliedFeatures = &'static [&'static str];
135135

136-
const ARM_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
136+
static ARM_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
137137
// tidy-alphabetical-start
138138
("aclass", Unstable(sym::arm_target_feature), &[]),
139139
("aes", Unstable(sym::arm_target_feature), &["neon"]),
@@ -172,7 +172,7 @@ const ARM_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
172172
// tidy-alphabetical-end
173173
];
174174

175-
const AARCH64_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
175+
static AARCH64_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
176176
// tidy-alphabetical-start
177177
// FEAT_AES & FEAT_PMULL
178178
("aes", Stable, &["neon"]),
@@ -368,7 +368,7 @@ const AARCH64_TIED_FEATURES: &[&[&str]] = &[
368368
&["paca", "pacg"], // Together these represent `pauth` in LLVM
369369
];
370370

371-
const X86_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
371+
static X86_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
372372
// tidy-alphabetical-start
373373
("adx", Stable, &[]),
374374
("aes", Stable, &["sse2"]),
@@ -446,7 +446,7 @@ const HEXAGON_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
446446
// tidy-alphabetical-end
447447
];
448448

449-
const POWERPC_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
449+
static POWERPC_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
450450
// tidy-alphabetical-start
451451
("altivec", Unstable(sym::powerpc_target_feature), &[]),
452452
("partword-atomics", Unstable(sym::powerpc_target_feature), &[]),
@@ -469,7 +469,7 @@ const MIPS_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
469469
// tidy-alphabetical-end
470470
];
471471

472-
const RISCV_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
472+
static RISCV_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
473473
// tidy-alphabetical-start
474474
("a", Stable, &["zaamo", "zalrsc"]),
475475
("c", Stable, &[]),
@@ -514,7 +514,7 @@ const RISCV_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
514514
// tidy-alphabetical-end
515515
];
516516

517-
const WASM_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
517+
static WASM_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
518518
// tidy-alphabetical-start
519519
("atomics", Unstable(sym::wasm_target_feature), &[]),
520520
("bulk-memory", Stable, &[]),
@@ -535,7 +535,7 @@ const WASM_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
535535
const BPF_FEATURES: &[(&str, Stability, ImpliedFeatures)] =
536536
&[("alu32", Unstable(sym::bpf_target_feature), &[])];
537537

538-
const CSKY_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
538+
static CSKY_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
539539
// tidy-alphabetical-start
540540
("10e60", Unstable(sym::csky_target_feature), &["7e10"]),
541541
("2e3", Unstable(sym::csky_target_feature), &["e2"]),
@@ -582,7 +582,7 @@ const CSKY_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
582582
// tidy-alphabetical-end
583583
];
584584

585-
const LOONGARCH_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
585+
static LOONGARCH_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
586586
// tidy-alphabetical-start
587587
("d", Unstable(sym::loongarch_target_feature), &["f"]),
588588
("f", Unstable(sym::loongarch_target_feature), &[]),
@@ -611,7 +611,7 @@ const SPARC_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
611611
// tidy-alphabetical-end
612612
];
613613

614-
const M68K_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
614+
static M68K_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
615615
// tidy-alphabetical-start
616616
("isa-68000", Unstable(sym::m68k_target_feature), &[]),
617617
("isa-68010", Unstable(sym::m68k_target_feature), &["isa-68000"]),

0 commit comments

Comments
 (0)