diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index 662f8ae614fcb..acc1f9b306e7d 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -577,7 +577,7 @@ impl String { return Cow::Borrowed(""); }; - const REPLACEMENT: &'static str = "\u{FFFD}"; + const REPLACEMENT: &str = "\u{FFFD}"; let mut res = String::with_capacity(v.len()); res.push_str(first_valid); diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 75ec0d7d50be6..0c5256b981e5c 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -1381,7 +1381,7 @@ impl<'a> Formatter<'a> { for part in formatted.parts { match *part { flt2dec::Part::Zero(mut nzeroes) => { - const ZEROES: &'static str = // 64 zeroes + const ZEROES: &str = // 64 zeroes "0000000000000000000000000000000000000000000000000000000000000000"; while nzeroes > ZEROES.len() { self.buf.write_str(ZEROES)?; diff --git a/src/libcore/unicode/printable.rs b/src/libcore/unicode/printable.rs index 519dd17bb9b3f..32e4b6b0fa512 100644 --- a/src/libcore/unicode/printable.rs +++ b/src/libcore/unicode/printable.rs @@ -80,7 +80,7 @@ pub(crate) fn is_printable(x: char) -> bool { } } -const SINGLETONS0U: &'static [(u8, u8)] = &[ +const SINGLETONS0U: &[(u8, u8)] = &[ (0x00, 1), (0x03, 5), (0x05, 6), @@ -122,7 +122,7 @@ const SINGLETONS0U: &'static [(u8, u8)] = &[ (0xfe, 3), (0xff, 9), ]; -const SINGLETONS0L: &'static [u8] = &[ +const SINGLETONS0L: &[u8] = &[ 0xad, 0x78, 0x79, 0x8b, 0x8d, 0xa2, 0x30, 0x57, 0x58, 0x8b, 0x8c, 0x90, 0x1c, 0x1d, 0xdd, 0x0e, 0x0f, 0x4b, 0x4c, 0xfb, 0xfc, 0x2e, 0x2f, 0x3f, @@ -162,7 +162,7 @@ const SINGLETONS0L: &'static [u8] = &[ 0x91, 0xfe, 0xff, 0x53, 0x67, 0x75, 0xc8, 0xc9, 0xd0, 0xd1, 0xd8, 0xd9, 0xe7, 0xfe, 0xff, ]; -const SINGLETONS1U: &'static [(u8, u8)] = &[ +const SINGLETONS1U: &[(u8, u8)] = &[ (0x00, 6), (0x01, 1), (0x03, 1), @@ -197,7 +197,7 @@ const SINGLETONS1U: &'static [(u8, u8)] = &[ (0xf0, 4), (0xf9, 4), ]; -const SINGLETONS1L: &'static [u8] = &[ +const SINGLETONS1L: &[u8] = &[ 0x0c, 0x27, 0x3b, 0x3e, 0x4e, 0x4f, 0x8f, 0x9e, 0x9e, 0x9f, 0x06, 0x07, 0x09, 0x36, 0x3d, 0x3e, 0x56, 0xf3, 0xd0, 0xd1, 0x04, 0x14, 0x18, 0x36, @@ -219,7 +219,7 @@ const SINGLETONS1L: &'static [u8] = &[ 0x78, 0x7d, 0x7f, 0x8a, 0xa4, 0xaa, 0xaf, 0xb0, 0xc0, 0xd0, 0x3f, 0x71, 0x72, 0x7b, ]; -const NORMAL0: &'static [u8] = &[ +const NORMAL0: &[u8] = &[ 0x00, 0x20, 0x5f, 0x22, 0x82, 0xdf, 0x04, @@ -363,7 +363,7 @@ const NORMAL0: &'static [u8] = &[ 0x1b, 0x03, 0x0f, 0x0d, ]; -const NORMAL1: &'static [u8] = &[ +const NORMAL1: &[u8] = &[ 0x5e, 0x22, 0x7b, 0x05, 0x03, 0x04, diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 388bbc52c3b1a..a20d04972fd75 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -381,7 +381,7 @@ macro_rules! define_dep_nodes { #[allow(dead_code, non_upper_case_globals)] pub mod label_strs { $( - pub const $variant: &'static str = stringify!($variant); + pub const $variant: &str = stringify!($variant); )* } ); diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index 9a0ceddcf1b4a..113a2377ac926 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -65,7 +65,7 @@ pub trait PpAnn { pub struct NoAnn; impl PpAnn for NoAnn {} -pub const NO_ANN: &'static dyn PpAnn = &NoAnn; +pub const NO_ANN: &dyn PpAnn = &NoAnn; impl PpAnn for hir::Crate { fn try_fetch_item(&self, item: ast::NodeId) -> Option<&hir::Item> { diff --git a/src/librustc/ich/mod.rs b/src/librustc/ich/mod.rs index 9751c560acd1e..fc2f1ee6ff892 100644 --- a/src/librustc/ich/mod.rs +++ b/src/librustc/ich/mod.rs @@ -24,15 +24,15 @@ mod impls_misc; mod impls_ty; mod impls_syntax; -pub const ATTR_DIRTY: &'static str = "rustc_dirty"; -pub const ATTR_CLEAN: &'static str = "rustc_clean"; -pub const ATTR_IF_THIS_CHANGED: &'static str = "rustc_if_this_changed"; -pub const ATTR_THEN_THIS_WOULD_NEED: &'static str = "rustc_then_this_would_need"; -pub const ATTR_PARTITION_REUSED: &'static str = "rustc_partition_reused"; -pub const ATTR_PARTITION_CODEGENED: &'static str = "rustc_partition_codegened"; -pub const ATTR_EXPECTED_CGU_REUSE: &'static str = "rustc_expected_cgu_reuse"; +pub const ATTR_DIRTY: &str = "rustc_dirty"; +pub const ATTR_CLEAN: &str = "rustc_clean"; +pub const ATTR_IF_THIS_CHANGED: &str = "rustc_if_this_changed"; +pub const ATTR_THEN_THIS_WOULD_NEED: &str = "rustc_then_this_would_need"; +pub const ATTR_PARTITION_REUSED: &str = "rustc_partition_reused"; +pub const ATTR_PARTITION_CODEGENED: &str = "rustc_partition_codegened"; +pub const ATTR_EXPECTED_CGU_REUSE: &str = "rustc_expected_cgu_reuse"; -pub const IGNORED_ATTRIBUTES: &'static [&'static str] = &[ +pub const IGNORED_ATTRIBUTES: &[&str] = &[ "cfg", ATTR_IF_THIS_CHANGED, ATTR_THEN_THIS_WOULD_NEED, diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 480d4a8e48f0e..e8b280fb3d802 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -780,43 +780,42 @@ macro_rules! options { } pub type $setter_name = fn(&mut $struct_name, v: Option<&str>) -> bool; - pub const $stat: &'static [(&'static str, $setter_name, - Option<&'static str>, &'static str)] = + pub const $stat: &[(&str, $setter_name, Option<&str>, &str)] = &[ $( (stringify!($opt), $mod_set::$opt, $mod_desc::$parse, $desc) ),* ]; #[allow(non_upper_case_globals, dead_code)] mod $mod_desc { - pub const parse_bool: Option<&'static str> = None; - pub const parse_opt_bool: Option<&'static str> = + pub const parse_bool: Option<&str> = None; + pub const parse_opt_bool: Option<&str> = Some("one of: `y`, `yes`, `on`, `n`, `no`, or `off`"); - pub const parse_string: Option<&'static str> = Some("a string"); - pub const parse_string_push: Option<&'static str> = Some("a string"); - pub const parse_pathbuf_push: Option<&'static str> = Some("a path"); - pub const parse_opt_string: Option<&'static str> = Some("a string"); - pub const parse_opt_pathbuf: Option<&'static str> = Some("a path"); - pub const parse_list: Option<&'static str> = Some("a space-separated list of strings"); - pub const parse_opt_list: Option<&'static str> = Some("a space-separated list of strings"); - pub const parse_uint: Option<&'static str> = Some("a number"); - pub const parse_passes: Option<&'static str> = + pub const parse_string: Option<&str> = Some("a string"); + pub const parse_string_push: Option<&str> = Some("a string"); + pub const parse_pathbuf_push: Option<&str> = Some("a path"); + pub const parse_opt_string: Option<&str> = Some("a string"); + pub const parse_opt_pathbuf: Option<&str> = Some("a path"); + pub const parse_list: Option<&str> = Some("a space-separated list of strings"); + pub const parse_opt_list: Option<&str> = Some("a space-separated list of strings"); + pub const parse_uint: Option<&str> = Some("a number"); + pub const parse_passes: Option<&str> = Some("a space-separated list of passes, or `all`"); - pub const parse_opt_uint: Option<&'static str> = + pub const parse_opt_uint: Option<&str> = Some("a number"); - pub const parse_panic_strategy: Option<&'static str> = + pub const parse_panic_strategy: Option<&str> = Some("either `unwind` or `abort`"); - pub const parse_relro_level: Option<&'static str> = + pub const parse_relro_level: Option<&str> = Some("one of: `full`, `partial`, or `off`"); - pub const parse_sanitizer: Option<&'static str> = + pub const parse_sanitizer: Option<&str> = Some("one of: `address`, `leak`, `memory` or `thread`"); - pub const parse_linker_flavor: Option<&'static str> = + pub const parse_linker_flavor: Option<&str> = Some(::rustc_target::spec::LinkerFlavor::one_of()); - pub const parse_optimization_fuel: Option<&'static str> = + pub const parse_optimization_fuel: Option<&str> = Some("crate=integer"); - pub const parse_unpretty: Option<&'static str> = + pub const parse_unpretty: Option<&str> = Some("`string` or `string=string`"); - pub const parse_lto: Option<&'static str> = + pub const parse_lto: Option<&str> = Some("either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, \ `fat`, or omitted"); - pub const parse_cross_lang_lto: Option<&'static str> = + pub const parse_cross_lang_lto: Option<&str> = Some("either a boolean (`yes`, `no`, `on`, `off`, etc), \ or the path to the linker plugin"); } diff --git a/src/librustc/session/filesearch.rs b/src/librustc/session/filesearch.rs index f410c270bcef9..e686a1d1275b6 100644 --- a/src/librustc/session/filesearch.rs +++ b/src/librustc/session/filesearch.rs @@ -179,12 +179,12 @@ fn find_libdir(sysroot: &Path) -> Cow<'static, str> { // "lib" (i.e. non-default), this value is used (see issue #16552). #[cfg(target_pointer_width = "64")] - const PRIMARY_LIB_DIR: &'static str = "lib64"; + const PRIMARY_LIB_DIR: &str = "lib64"; #[cfg(target_pointer_width = "32")] - const PRIMARY_LIB_DIR: &'static str = "lib32"; + const PRIMARY_LIB_DIR: &str = "lib32"; - const SECONDARY_LIB_DIR: &'static str = "lib"; + const SECONDARY_LIB_DIR: &str = "lib"; match option_env!("CFG_LIBDIR_RELATIVE") { Some(libdir) if libdir != "lib" => libdir.into(), @@ -198,4 +198,4 @@ fn find_libdir(sysroot: &Path) -> Cow<'static, str> { // The name of rustc's own place to organize libraries. // Used to be "rustc", now the default is "rustlib" -const RUST_LIB_DIR: &'static str = "rustlib"; +const RUST_LIB_DIR: &str = "rustlib"; diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index 7a246af82e5fe..c6ba20de0d3b9 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -28,7 +28,7 @@ use lazy_static; use session::Session; // The name of the associated type for `Fn` return types -pub const FN_OUTPUT_NAME: &'static str = "Output"; +pub const FN_OUTPUT_NAME: &str = "Output"; // Useful type to use with `Result<>` indicate that an error has already // been reported to the user, so no need to continue checking. diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs index 0fb2641a4f82e..23b35b2e41654 100644 --- a/src/librustc_codegen_ssa/back/symbol_export.rs +++ b/src/librustc_codegen_ssa/back/symbol_export.rs @@ -225,7 +225,7 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // These are weak symbols that point to the profile version and the // profile name, which need to be treated as exported so LTO doesn't nix // them. - const PROFILER_WEAK_SYMBOLS: [&'static str; 2] = [ + const PROFILER_WEAK_SYMBOLS: [&str; 2] = [ "__llvm_profile_raw_version", "__llvm_profile_filename", ]; diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs index 344a252578472..611d7b137c6f2 100644 --- a/src/librustc_codegen_utils/symbol_names.rs +++ b/src/librustc_codegen_utils/symbol_names.rs @@ -389,7 +389,7 @@ impl SymbolPathBuffer { impl ItemPathBuffer for SymbolPathBuffer { fn root_mode(&self) -> &RootMode { - const ABSOLUTE: &'static RootMode = &RootMode::Absolute; + const ABSOLUTE: &RootMode = &RootMode::Absolute; ABSOLUTE } diff --git a/src/librustc_incremental/assert_module_sources.rs b/src/librustc_incremental/assert_module_sources.rs index 4ff2529b26d93..17ac9a6b53973 100644 --- a/src/librustc_incremental/assert_module_sources.rs +++ b/src/librustc_incremental/assert_module_sources.rs @@ -40,9 +40,9 @@ use syntax::ast; use rustc::ich::{ATTR_PARTITION_REUSED, ATTR_PARTITION_CODEGENED, ATTR_EXPECTED_CGU_REUSE}; -const MODULE: &'static str = "module"; -const CFG: &'static str = "cfg"; -const KIND: &'static str = "kind"; +const MODULE: &str = "module"; +const CFG: &str = "cfg"; +const KIND: &str = "kind"; pub fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { tcx.dep_graph.with_ignore(|| { diff --git a/src/librustc_incremental/persist/file_format.rs b/src/librustc_incremental/persist/file_format.rs index 98f7873fda0e4..e5faba6178233 100644 --- a/src/librustc_incremental/persist/file_format.rs +++ b/src/librustc_incremental/persist/file_format.rs @@ -28,7 +28,7 @@ use rustc::session::config::nightly_options; use rustc_serialize::opaque::Encoder; /// The first few bytes of files generated by incremental compilation -const FILE_MAGIC: &'static [u8] = b"RSIC"; +const FILE_MAGIC: &[u8] = b"RSIC"; /// Change this if the header format changes const HEADER_FORMAT_VERSION: u16 = 0; @@ -36,7 +36,7 @@ const HEADER_FORMAT_VERSION: u16 = 0; /// A version string that hopefully is always different for compiler versions /// with different encodings of incremental compilation artifacts. Contains /// the git commit hash. -const RUSTC_VERSION: Option<&'static str> = option_env!("CFG_VERSION"); +const RUSTC_VERSION: Option<&str> = option_env!("CFG_VERSION"); pub fn write_file_header(stream: &mut Encoder) { stream.emit_raw_bytes(FILE_MAGIC); diff --git a/src/librustc_incremental/persist/fs.rs b/src/librustc_incremental/persist/fs.rs index 75cdefaf49f00..bc98798f77253 100644 --- a/src/librustc_incremental/persist/fs.rs +++ b/src/librustc_incremental/persist/fs.rs @@ -128,10 +128,10 @@ use std::time::{UNIX_EPOCH, SystemTime, Duration}; use rand::{RngCore, thread_rng}; -const LOCK_FILE_EXT: &'static str = ".lock"; -const DEP_GRAPH_FILENAME: &'static str = "dep-graph.bin"; -const WORK_PRODUCTS_FILENAME: &'static str = "work-products.bin"; -const QUERY_CACHE_FILENAME: &'static str = "query-cache.bin"; +const LOCK_FILE_EXT: &str = ".lock"; +const DEP_GRAPH_FILENAME: &str = "dep-graph.bin"; +const WORK_PRODUCTS_FILENAME: &str = "work-products.bin"; +const QUERY_CACHE_FILENAME: &str = "query-cache.bin"; // We encode integers using the following base, so they are shorter than decimal // or hexadecimal numbers (we want short file and directory names). Since these diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs index e91d15b78c075..fc3af6cf2e732 100644 --- a/src/librustc_metadata/schema.rs +++ b/src/librustc_metadata/schema.rs @@ -52,7 +52,7 @@ pub const METADATA_VERSION: u8 = 4; /// This header is followed by the position of the `CrateRoot`, /// which is encoded as a 32-bit big-endian unsigned integer, /// and further followed by the rustc version string. -pub const METADATA_HEADER: &'static [u8; 12] = +pub const METADATA_HEADER: &[u8; 12] = &[0, 0, 0, 0, b'r', b'u', b's', b't', 0, 0, 0, METADATA_VERSION]; /// A value of type T referred to by its absolute position diff --git a/src/librustc_mir/dataflow/graphviz.rs b/src/librustc_mir/dataflow/graphviz.rs index 6896c91352fdd..f6a9d46b5e2cb 100644 --- a/src/librustc_mir/dataflow/graphviz.rs +++ b/src/librustc_mir/dataflow/graphviz.rs @@ -137,8 +137,8 @@ where MWF: MirWithFlowState<'tcx>, block: BasicBlock, mir: &Mir) -> io::Result<()> { // Header rows - const HDRS: [&'static str; 4] = ["ENTRY", "MIR", "BLOCK GENS", "BLOCK KILLS"]; - const HDR_FMT: &'static str = "bgcolor=\"grey\""; + const HDRS: [&str; 4] = ["ENTRY", "MIR", "BLOCK GENS", "BLOCK KILLS"]; + const HDR_FMT: &str = "bgcolor=\"grey\""; write!(w, "
", HDRS.len())?; write!(w, "{:?}", block.index())?; write!(w, " |