Skip to content

Commit e941e1a

Browse files
authored
Rollup merge of #56500 - ljedrz:cleanup_rest_of_const_lifetimes, r=zackmdavis
cleanup: remove static lifetimes from consts A follow-up to #56497.
2 parents 50148a9 + d0c64bb commit e941e1a

File tree

26 files changed

+88
-91
lines changed

26 files changed

+88
-91
lines changed

src/liballoc/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ impl String {
577577
return Cow::Borrowed("");
578578
};
579579

580-
const REPLACEMENT: &'static str = "\u{FFFD}";
580+
const REPLACEMENT: &str = "\u{FFFD}";
581581

582582
let mut res = String::with_capacity(v.len());
583583
res.push_str(first_valid);

src/libcore/fmt/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1381,7 +1381,7 @@ impl<'a> Formatter<'a> {
13811381
for part in formatted.parts {
13821382
match *part {
13831383
flt2dec::Part::Zero(mut nzeroes) => {
1384-
const ZEROES: &'static str = // 64 zeroes
1384+
const ZEROES: &str = // 64 zeroes
13851385
"0000000000000000000000000000000000000000000000000000000000000000";
13861386
while nzeroes > ZEROES.len() {
13871387
self.buf.write_str(ZEROES)?;

src/libcore/unicode/printable.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub(crate) fn is_printable(x: char) -> bool {
8080
}
8181
}
8282

83-
const SINGLETONS0U: &'static [(u8, u8)] = &[
83+
const SINGLETONS0U: &[(u8, u8)] = &[
8484
(0x00, 1),
8585
(0x03, 5),
8686
(0x05, 6),
@@ -122,7 +122,7 @@ const SINGLETONS0U: &'static [(u8, u8)] = &[
122122
(0xfe, 3),
123123
(0xff, 9),
124124
];
125-
const SINGLETONS0L: &'static [u8] = &[
125+
const SINGLETONS0L: &[u8] = &[
126126
0xad, 0x78, 0x79, 0x8b, 0x8d, 0xa2, 0x30, 0x57,
127127
0x58, 0x8b, 0x8c, 0x90, 0x1c, 0x1d, 0xdd, 0x0e,
128128
0x0f, 0x4b, 0x4c, 0xfb, 0xfc, 0x2e, 0x2f, 0x3f,
@@ -162,7 +162,7 @@ const SINGLETONS0L: &'static [u8] = &[
162162
0x91, 0xfe, 0xff, 0x53, 0x67, 0x75, 0xc8, 0xc9,
163163
0xd0, 0xd1, 0xd8, 0xd9, 0xe7, 0xfe, 0xff,
164164
];
165-
const SINGLETONS1U: &'static [(u8, u8)] = &[
165+
const SINGLETONS1U: &[(u8, u8)] = &[
166166
(0x00, 6),
167167
(0x01, 1),
168168
(0x03, 1),
@@ -197,7 +197,7 @@ const SINGLETONS1U: &'static [(u8, u8)] = &[
197197
(0xf0, 4),
198198
(0xf9, 4),
199199
];
200-
const SINGLETONS1L: &'static [u8] = &[
200+
const SINGLETONS1L: &[u8] = &[
201201
0x0c, 0x27, 0x3b, 0x3e, 0x4e, 0x4f, 0x8f, 0x9e,
202202
0x9e, 0x9f, 0x06, 0x07, 0x09, 0x36, 0x3d, 0x3e,
203203
0x56, 0xf3, 0xd0, 0xd1, 0x04, 0x14, 0x18, 0x36,
@@ -219,7 +219,7 @@ const SINGLETONS1L: &'static [u8] = &[
219219
0x78, 0x7d, 0x7f, 0x8a, 0xa4, 0xaa, 0xaf, 0xb0,
220220
0xc0, 0xd0, 0x3f, 0x71, 0x72, 0x7b,
221221
];
222-
const NORMAL0: &'static [u8] = &[
222+
const NORMAL0: &[u8] = &[
223223
0x00, 0x20,
224224
0x5f, 0x22,
225225
0x82, 0xdf, 0x04,
@@ -363,7 +363,7 @@ const NORMAL0: &'static [u8] = &[
363363
0x1b, 0x03,
364364
0x0f, 0x0d,
365365
];
366-
const NORMAL1: &'static [u8] = &[
366+
const NORMAL1: &[u8] = &[
367367
0x5e, 0x22,
368368
0x7b, 0x05,
369369
0x03, 0x04,

src/librustc/dep_graph/dep_node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ macro_rules! define_dep_nodes {
381381
#[allow(dead_code, non_upper_case_globals)]
382382
pub mod label_strs {
383383
$(
384-
pub const $variant: &'static str = stringify!($variant);
384+
pub const $variant: &str = stringify!($variant);
385385
)*
386386
}
387387
);

src/librustc/hir/print.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub trait PpAnn {
6565

6666
pub struct NoAnn;
6767
impl PpAnn for NoAnn {}
68-
pub const NO_ANN: &'static dyn PpAnn = &NoAnn;
68+
pub const NO_ANN: &dyn PpAnn = &NoAnn;
6969

7070
impl PpAnn for hir::Crate {
7171
fn try_fetch_item(&self, item: ast::NodeId) -> Option<&hir::Item> {

src/librustc/ich/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ mod impls_misc;
2424
mod impls_ty;
2525
mod impls_syntax;
2626

27-
pub const ATTR_DIRTY: &'static str = "rustc_dirty";
28-
pub const ATTR_CLEAN: &'static str = "rustc_clean";
29-
pub const ATTR_IF_THIS_CHANGED: &'static str = "rustc_if_this_changed";
30-
pub const ATTR_THEN_THIS_WOULD_NEED: &'static str = "rustc_then_this_would_need";
31-
pub const ATTR_PARTITION_REUSED: &'static str = "rustc_partition_reused";
32-
pub const ATTR_PARTITION_CODEGENED: &'static str = "rustc_partition_codegened";
33-
pub const ATTR_EXPECTED_CGU_REUSE: &'static str = "rustc_expected_cgu_reuse";
27+
pub const ATTR_DIRTY: &str = "rustc_dirty";
28+
pub const ATTR_CLEAN: &str = "rustc_clean";
29+
pub const ATTR_IF_THIS_CHANGED: &str = "rustc_if_this_changed";
30+
pub const ATTR_THEN_THIS_WOULD_NEED: &str = "rustc_then_this_would_need";
31+
pub const ATTR_PARTITION_REUSED: &str = "rustc_partition_reused";
32+
pub const ATTR_PARTITION_CODEGENED: &str = "rustc_partition_codegened";
33+
pub const ATTR_EXPECTED_CGU_REUSE: &str = "rustc_expected_cgu_reuse";
3434

35-
pub const IGNORED_ATTRIBUTES: &'static [&'static str] = &[
35+
pub const IGNORED_ATTRIBUTES: &[&str] = &[
3636
"cfg",
3737
ATTR_IF_THIS_CHANGED,
3838
ATTR_THEN_THIS_WOULD_NEED,

src/librustc/session/config.rs

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -780,43 +780,42 @@ macro_rules! options {
780780
}
781781

782782
pub type $setter_name = fn(&mut $struct_name, v: Option<&str>) -> bool;
783-
pub const $stat: &'static [(&'static str, $setter_name,
784-
Option<&'static str>, &'static str)] =
783+
pub const $stat: &[(&str, $setter_name, Option<&str>, &str)] =
785784
&[ $( (stringify!($opt), $mod_set::$opt, $mod_desc::$parse, $desc) ),* ];
786785

787786
#[allow(non_upper_case_globals, dead_code)]
788787
mod $mod_desc {
789-
pub const parse_bool: Option<&'static str> = None;
790-
pub const parse_opt_bool: Option<&'static str> =
788+
pub const parse_bool: Option<&str> = None;
789+
pub const parse_opt_bool: Option<&str> =
791790
Some("one of: `y`, `yes`, `on`, `n`, `no`, or `off`");
792-
pub const parse_string: Option<&'static str> = Some("a string");
793-
pub const parse_string_push: Option<&'static str> = Some("a string");
794-
pub const parse_pathbuf_push: Option<&'static str> = Some("a path");
795-
pub const parse_opt_string: Option<&'static str> = Some("a string");
796-
pub const parse_opt_pathbuf: Option<&'static str> = Some("a path");
797-
pub const parse_list: Option<&'static str> = Some("a space-separated list of strings");
798-
pub const parse_opt_list: Option<&'static str> = Some("a space-separated list of strings");
799-
pub const parse_uint: Option<&'static str> = Some("a number");
800-
pub const parse_passes: Option<&'static str> =
791+
pub const parse_string: Option<&str> = Some("a string");
792+
pub const parse_string_push: Option<&str> = Some("a string");
793+
pub const parse_pathbuf_push: Option<&str> = Some("a path");
794+
pub const parse_opt_string: Option<&str> = Some("a string");
795+
pub const parse_opt_pathbuf: Option<&str> = Some("a path");
796+
pub const parse_list: Option<&str> = Some("a space-separated list of strings");
797+
pub const parse_opt_list: Option<&str> = Some("a space-separated list of strings");
798+
pub const parse_uint: Option<&str> = Some("a number");
799+
pub const parse_passes: Option<&str> =
801800
Some("a space-separated list of passes, or `all`");
802-
pub const parse_opt_uint: Option<&'static str> =
801+
pub const parse_opt_uint: Option<&str> =
803802
Some("a number");
804-
pub const parse_panic_strategy: Option<&'static str> =
803+
pub const parse_panic_strategy: Option<&str> =
805804
Some("either `unwind` or `abort`");
806-
pub const parse_relro_level: Option<&'static str> =
805+
pub const parse_relro_level: Option<&str> =
807806
Some("one of: `full`, `partial`, or `off`");
808-
pub const parse_sanitizer: Option<&'static str> =
807+
pub const parse_sanitizer: Option<&str> =
809808
Some("one of: `address`, `leak`, `memory` or `thread`");
810-
pub const parse_linker_flavor: Option<&'static str> =
809+
pub const parse_linker_flavor: Option<&str> =
811810
Some(::rustc_target::spec::LinkerFlavor::one_of());
812-
pub const parse_optimization_fuel: Option<&'static str> =
811+
pub const parse_optimization_fuel: Option<&str> =
813812
Some("crate=integer");
814-
pub const parse_unpretty: Option<&'static str> =
813+
pub const parse_unpretty: Option<&str> =
815814
Some("`string` or `string=string`");
816-
pub const parse_lto: Option<&'static str> =
815+
pub const parse_lto: Option<&str> =
817816
Some("either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, \
818817
`fat`, or omitted");
819-
pub const parse_cross_lang_lto: Option<&'static str> =
818+
pub const parse_cross_lang_lto: Option<&str> =
820819
Some("either a boolean (`yes`, `no`, `on`, `off`, etc), \
821820
or the path to the linker plugin");
822821
}

src/librustc/session/filesearch.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,12 @@ fn find_libdir(sysroot: &Path) -> Cow<'static, str> {
179179
// "lib" (i.e. non-default), this value is used (see issue #16552).
180180

181181
#[cfg(target_pointer_width = "64")]
182-
const PRIMARY_LIB_DIR: &'static str = "lib64";
182+
const PRIMARY_LIB_DIR: &str = "lib64";
183183

184184
#[cfg(target_pointer_width = "32")]
185-
const PRIMARY_LIB_DIR: &'static str = "lib32";
185+
const PRIMARY_LIB_DIR: &str = "lib32";
186186

187-
const SECONDARY_LIB_DIR: &'static str = "lib";
187+
const SECONDARY_LIB_DIR: &str = "lib";
188188

189189
match option_env!("CFG_LIBDIR_RELATIVE") {
190190
Some(libdir) if libdir != "lib" => libdir.into(),
@@ -198,4 +198,4 @@ fn find_libdir(sysroot: &Path) -> Cow<'static, str> {
198198

199199
// The name of rustc's own place to organize libraries.
200200
// Used to be "rustc", now the default is "rustlib"
201-
const RUST_LIB_DIR: &'static str = "rustlib";
201+
const RUST_LIB_DIR: &str = "rustlib";

src/librustc/util/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use lazy_static;
2828
use session::Session;
2929

3030
// The name of the associated type for `Fn` return types
31-
pub const FN_OUTPUT_NAME: &'static str = "Output";
31+
pub const FN_OUTPUT_NAME: &str = "Output";
3232

3333
// Useful type to use with `Result<>` indicate that an error has already
3434
// been reported to the user, so no need to continue checking.

src/librustc_codegen_ssa/back/symbol_export.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
225225
// These are weak symbols that point to the profile version and the
226226
// profile name, which need to be treated as exported so LTO doesn't nix
227227
// them.
228-
const PROFILER_WEAK_SYMBOLS: [&'static str; 2] = [
228+
const PROFILER_WEAK_SYMBOLS: [&str; 2] = [
229229
"__llvm_profile_raw_version",
230230
"__llvm_profile_filename",
231231
];

0 commit comments

Comments
 (0)