cleanup: remove static lifetimes from consts
This commit is contained in:
parent
91d5d56c00
commit
d0c64bb296
26 changed files with 88 additions and 91 deletions
|
@ -577,7 +577,7 @@ impl String {
|
||||||
return Cow::Borrowed("");
|
return Cow::Borrowed("");
|
||||||
};
|
};
|
||||||
|
|
||||||
const REPLACEMENT: &'static str = "\u{FFFD}";
|
const REPLACEMENT: &str = "\u{FFFD}";
|
||||||
|
|
||||||
let mut res = String::with_capacity(v.len());
|
let mut res = String::with_capacity(v.len());
|
||||||
res.push_str(first_valid);
|
res.push_str(first_valid);
|
||||||
|
|
|
@ -1381,7 +1381,7 @@ impl<'a> Formatter<'a> {
|
||||||
for part in formatted.parts {
|
for part in formatted.parts {
|
||||||
match *part {
|
match *part {
|
||||||
flt2dec::Part::Zero(mut nzeroes) => {
|
flt2dec::Part::Zero(mut nzeroes) => {
|
||||||
const ZEROES: &'static str = // 64 zeroes
|
const ZEROES: &str = // 64 zeroes
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000";
|
"0000000000000000000000000000000000000000000000000000000000000000";
|
||||||
while nzeroes > ZEROES.len() {
|
while nzeroes > ZEROES.len() {
|
||||||
self.buf.write_str(ZEROES)?;
|
self.buf.write_str(ZEROES)?;
|
||||||
|
|
|
@ -80,7 +80,7 @@ pub(crate) fn is_printable(x: char) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const SINGLETONS0U: &'static [(u8, u8)] = &[
|
const SINGLETONS0U: &[(u8, u8)] = &[
|
||||||
(0x00, 1),
|
(0x00, 1),
|
||||||
(0x03, 5),
|
(0x03, 5),
|
||||||
(0x05, 6),
|
(0x05, 6),
|
||||||
|
@ -122,7 +122,7 @@ const SINGLETONS0U: &'static [(u8, u8)] = &[
|
||||||
(0xfe, 3),
|
(0xfe, 3),
|
||||||
(0xff, 9),
|
(0xff, 9),
|
||||||
];
|
];
|
||||||
const SINGLETONS0L: &'static [u8] = &[
|
const SINGLETONS0L: &[u8] = &[
|
||||||
0xad, 0x78, 0x79, 0x8b, 0x8d, 0xa2, 0x30, 0x57,
|
0xad, 0x78, 0x79, 0x8b, 0x8d, 0xa2, 0x30, 0x57,
|
||||||
0x58, 0x8b, 0x8c, 0x90, 0x1c, 0x1d, 0xdd, 0x0e,
|
0x58, 0x8b, 0x8c, 0x90, 0x1c, 0x1d, 0xdd, 0x0e,
|
||||||
0x0f, 0x4b, 0x4c, 0xfb, 0xfc, 0x2e, 0x2f, 0x3f,
|
0x0f, 0x4b, 0x4c, 0xfb, 0xfc, 0x2e, 0x2f, 0x3f,
|
||||||
|
@ -162,7 +162,7 @@ const SINGLETONS0L: &'static [u8] = &[
|
||||||
0x91, 0xfe, 0xff, 0x53, 0x67, 0x75, 0xc8, 0xc9,
|
0x91, 0xfe, 0xff, 0x53, 0x67, 0x75, 0xc8, 0xc9,
|
||||||
0xd0, 0xd1, 0xd8, 0xd9, 0xe7, 0xfe, 0xff,
|
0xd0, 0xd1, 0xd8, 0xd9, 0xe7, 0xfe, 0xff,
|
||||||
];
|
];
|
||||||
const SINGLETONS1U: &'static [(u8, u8)] = &[
|
const SINGLETONS1U: &[(u8, u8)] = &[
|
||||||
(0x00, 6),
|
(0x00, 6),
|
||||||
(0x01, 1),
|
(0x01, 1),
|
||||||
(0x03, 1),
|
(0x03, 1),
|
||||||
|
@ -197,7 +197,7 @@ const SINGLETONS1U: &'static [(u8, u8)] = &[
|
||||||
(0xf0, 4),
|
(0xf0, 4),
|
||||||
(0xf9, 4),
|
(0xf9, 4),
|
||||||
];
|
];
|
||||||
const SINGLETONS1L: &'static [u8] = &[
|
const SINGLETONS1L: &[u8] = &[
|
||||||
0x0c, 0x27, 0x3b, 0x3e, 0x4e, 0x4f, 0x8f, 0x9e,
|
0x0c, 0x27, 0x3b, 0x3e, 0x4e, 0x4f, 0x8f, 0x9e,
|
||||||
0x9e, 0x9f, 0x06, 0x07, 0x09, 0x36, 0x3d, 0x3e,
|
0x9e, 0x9f, 0x06, 0x07, 0x09, 0x36, 0x3d, 0x3e,
|
||||||
0x56, 0xf3, 0xd0, 0xd1, 0x04, 0x14, 0x18, 0x36,
|
0x56, 0xf3, 0xd0, 0xd1, 0x04, 0x14, 0x18, 0x36,
|
||||||
|
@ -219,7 +219,7 @@ const SINGLETONS1L: &'static [u8] = &[
|
||||||
0x78, 0x7d, 0x7f, 0x8a, 0xa4, 0xaa, 0xaf, 0xb0,
|
0x78, 0x7d, 0x7f, 0x8a, 0xa4, 0xaa, 0xaf, 0xb0,
|
||||||
0xc0, 0xd0, 0x3f, 0x71, 0x72, 0x7b,
|
0xc0, 0xd0, 0x3f, 0x71, 0x72, 0x7b,
|
||||||
];
|
];
|
||||||
const NORMAL0: &'static [u8] = &[
|
const NORMAL0: &[u8] = &[
|
||||||
0x00, 0x20,
|
0x00, 0x20,
|
||||||
0x5f, 0x22,
|
0x5f, 0x22,
|
||||||
0x82, 0xdf, 0x04,
|
0x82, 0xdf, 0x04,
|
||||||
|
@ -363,7 +363,7 @@ const NORMAL0: &'static [u8] = &[
|
||||||
0x1b, 0x03,
|
0x1b, 0x03,
|
||||||
0x0f, 0x0d,
|
0x0f, 0x0d,
|
||||||
];
|
];
|
||||||
const NORMAL1: &'static [u8] = &[
|
const NORMAL1: &[u8] = &[
|
||||||
0x5e, 0x22,
|
0x5e, 0x22,
|
||||||
0x7b, 0x05,
|
0x7b, 0x05,
|
||||||
0x03, 0x04,
|
0x03, 0x04,
|
||||||
|
|
|
@ -381,7 +381,7 @@ macro_rules! define_dep_nodes {
|
||||||
#[allow(dead_code, non_upper_case_globals)]
|
#[allow(dead_code, non_upper_case_globals)]
|
||||||
pub mod label_strs {
|
pub mod label_strs {
|
||||||
$(
|
$(
|
||||||
pub const $variant: &'static str = stringify!($variant);
|
pub const $variant: &str = stringify!($variant);
|
||||||
)*
|
)*
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -65,7 +65,7 @@ pub trait PpAnn {
|
||||||
|
|
||||||
pub struct NoAnn;
|
pub struct NoAnn;
|
||||||
impl PpAnn for 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 {
|
impl PpAnn for hir::Crate {
|
||||||
fn try_fetch_item(&self, item: ast::NodeId) -> Option<&hir::Item> {
|
fn try_fetch_item(&self, item: ast::NodeId) -> Option<&hir::Item> {
|
||||||
|
|
|
@ -24,15 +24,15 @@ mod impls_misc;
|
||||||
mod impls_ty;
|
mod impls_ty;
|
||||||
mod impls_syntax;
|
mod impls_syntax;
|
||||||
|
|
||||||
pub const ATTR_DIRTY: &'static str = "rustc_dirty";
|
pub const ATTR_DIRTY: &str = "rustc_dirty";
|
||||||
pub const ATTR_CLEAN: &'static str = "rustc_clean";
|
pub const ATTR_CLEAN: &str = "rustc_clean";
|
||||||
pub const ATTR_IF_THIS_CHANGED: &'static str = "rustc_if_this_changed";
|
pub const ATTR_IF_THIS_CHANGED: &str = "rustc_if_this_changed";
|
||||||
pub const ATTR_THEN_THIS_WOULD_NEED: &'static str = "rustc_then_this_would_need";
|
pub const ATTR_THEN_THIS_WOULD_NEED: &str = "rustc_then_this_would_need";
|
||||||
pub const ATTR_PARTITION_REUSED: &'static str = "rustc_partition_reused";
|
pub const ATTR_PARTITION_REUSED: &str = "rustc_partition_reused";
|
||||||
pub const ATTR_PARTITION_CODEGENED: &'static str = "rustc_partition_codegened";
|
pub const ATTR_PARTITION_CODEGENED: &str = "rustc_partition_codegened";
|
||||||
pub const ATTR_EXPECTED_CGU_REUSE: &'static str = "rustc_expected_cgu_reuse";
|
pub const ATTR_EXPECTED_CGU_REUSE: &str = "rustc_expected_cgu_reuse";
|
||||||
|
|
||||||
pub const IGNORED_ATTRIBUTES: &'static [&'static str] = &[
|
pub const IGNORED_ATTRIBUTES: &[&str] = &[
|
||||||
"cfg",
|
"cfg",
|
||||||
ATTR_IF_THIS_CHANGED,
|
ATTR_IF_THIS_CHANGED,
|
||||||
ATTR_THEN_THIS_WOULD_NEED,
|
ATTR_THEN_THIS_WOULD_NEED,
|
||||||
|
|
|
@ -780,43 +780,42 @@ macro_rules! options {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type $setter_name = fn(&mut $struct_name, v: Option<&str>) -> bool;
|
pub type $setter_name = fn(&mut $struct_name, v: Option<&str>) -> bool;
|
||||||
pub const $stat: &'static [(&'static str, $setter_name,
|
pub const $stat: &[(&str, $setter_name, Option<&str>, &str)] =
|
||||||
Option<&'static str>, &'static str)] =
|
|
||||||
&[ $( (stringify!($opt), $mod_set::$opt, $mod_desc::$parse, $desc) ),* ];
|
&[ $( (stringify!($opt), $mod_set::$opt, $mod_desc::$parse, $desc) ),* ];
|
||||||
|
|
||||||
#[allow(non_upper_case_globals, dead_code)]
|
#[allow(non_upper_case_globals, dead_code)]
|
||||||
mod $mod_desc {
|
mod $mod_desc {
|
||||||
pub const parse_bool: Option<&'static str> = None;
|
pub const parse_bool: Option<&str> = None;
|
||||||
pub const parse_opt_bool: Option<&'static str> =
|
pub const parse_opt_bool: Option<&str> =
|
||||||
Some("one of: `y`, `yes`, `on`, `n`, `no`, or `off`");
|
Some("one of: `y`, `yes`, `on`, `n`, `no`, or `off`");
|
||||||
pub const parse_string: Option<&'static str> = Some("a string");
|
pub const parse_string: Option<&str> = Some("a string");
|
||||||
pub const parse_string_push: Option<&'static str> = Some("a string");
|
pub const parse_string_push: Option<&str> = Some("a string");
|
||||||
pub const parse_pathbuf_push: Option<&'static str> = Some("a path");
|
pub const parse_pathbuf_push: Option<&str> = Some("a path");
|
||||||
pub const parse_opt_string: Option<&'static str> = Some("a string");
|
pub const parse_opt_string: Option<&str> = Some("a string");
|
||||||
pub const parse_opt_pathbuf: Option<&'static str> = Some("a path");
|
pub const parse_opt_pathbuf: Option<&str> = Some("a path");
|
||||||
pub const parse_list: Option<&'static str> = Some("a space-separated list of strings");
|
pub const parse_list: Option<&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_opt_list: Option<&str> = Some("a space-separated list of strings");
|
||||||
pub const parse_uint: Option<&'static str> = Some("a number");
|
pub const parse_uint: Option<&str> = Some("a number");
|
||||||
pub const parse_passes: Option<&'static str> =
|
pub const parse_passes: Option<&str> =
|
||||||
Some("a space-separated list of passes, or `all`");
|
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");
|
Some("a number");
|
||||||
pub const parse_panic_strategy: Option<&'static str> =
|
pub const parse_panic_strategy: Option<&str> =
|
||||||
Some("either `unwind` or `abort`");
|
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`");
|
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`");
|
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());
|
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");
|
Some("crate=integer");
|
||||||
pub const parse_unpretty: Option<&'static str> =
|
pub const parse_unpretty: Option<&str> =
|
||||||
Some("`string` or `string=string`");
|
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`, \
|
Some("either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, \
|
||||||
`fat`, or omitted");
|
`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), \
|
Some("either a boolean (`yes`, `no`, `on`, `off`, etc), \
|
||||||
or the path to the linker plugin");
|
or the path to the linker plugin");
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,12 +179,12 @@ fn find_libdir(sysroot: &Path) -> Cow<'static, str> {
|
||||||
// "lib" (i.e. non-default), this value is used (see issue #16552).
|
// "lib" (i.e. non-default), this value is used (see issue #16552).
|
||||||
|
|
||||||
#[cfg(target_pointer_width = "64")]
|
#[cfg(target_pointer_width = "64")]
|
||||||
const PRIMARY_LIB_DIR: &'static str = "lib64";
|
const PRIMARY_LIB_DIR: &str = "lib64";
|
||||||
|
|
||||||
#[cfg(target_pointer_width = "32")]
|
#[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") {
|
match option_env!("CFG_LIBDIR_RELATIVE") {
|
||||||
Some(libdir) if libdir != "lib" => libdir.into(),
|
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.
|
// The name of rustc's own place to organize libraries.
|
||||||
// Used to be "rustc", now the default is "rustlib"
|
// Used to be "rustc", now the default is "rustlib"
|
||||||
const RUST_LIB_DIR: &'static str = "rustlib";
|
const RUST_LIB_DIR: &str = "rustlib";
|
||||||
|
|
|
@ -28,7 +28,7 @@ use lazy_static;
|
||||||
use session::Session;
|
use session::Session;
|
||||||
|
|
||||||
// The name of the associated type for `Fn` return types
|
// 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
|
// Useful type to use with `Result<>` indicate that an error has already
|
||||||
// been reported to the user, so no need to continue checking.
|
// been reported to the user, so no need to continue checking.
|
||||||
|
|
|
@ -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
|
// 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
|
// profile name, which need to be treated as exported so LTO doesn't nix
|
||||||
// them.
|
// them.
|
||||||
const PROFILER_WEAK_SYMBOLS: [&'static str; 2] = [
|
const PROFILER_WEAK_SYMBOLS: [&str; 2] = [
|
||||||
"__llvm_profile_raw_version",
|
"__llvm_profile_raw_version",
|
||||||
"__llvm_profile_filename",
|
"__llvm_profile_filename",
|
||||||
];
|
];
|
||||||
|
|
|
@ -389,7 +389,7 @@ impl SymbolPathBuffer {
|
||||||
|
|
||||||
impl ItemPathBuffer for SymbolPathBuffer {
|
impl ItemPathBuffer for SymbolPathBuffer {
|
||||||
fn root_mode(&self) -> &RootMode {
|
fn root_mode(&self) -> &RootMode {
|
||||||
const ABSOLUTE: &'static RootMode = &RootMode::Absolute;
|
const ABSOLUTE: &RootMode = &RootMode::Absolute;
|
||||||
ABSOLUTE
|
ABSOLUTE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,9 @@ use syntax::ast;
|
||||||
use rustc::ich::{ATTR_PARTITION_REUSED, ATTR_PARTITION_CODEGENED,
|
use rustc::ich::{ATTR_PARTITION_REUSED, ATTR_PARTITION_CODEGENED,
|
||||||
ATTR_EXPECTED_CGU_REUSE};
|
ATTR_EXPECTED_CGU_REUSE};
|
||||||
|
|
||||||
const MODULE: &'static str = "module";
|
const MODULE: &str = "module";
|
||||||
const CFG: &'static str = "cfg";
|
const CFG: &str = "cfg";
|
||||||
const KIND: &'static str = "kind";
|
const KIND: &str = "kind";
|
||||||
|
|
||||||
pub fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
|
pub fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
|
||||||
tcx.dep_graph.with_ignore(|| {
|
tcx.dep_graph.with_ignore(|| {
|
||||||
|
|
|
@ -28,7 +28,7 @@ use rustc::session::config::nightly_options;
|
||||||
use rustc_serialize::opaque::Encoder;
|
use rustc_serialize::opaque::Encoder;
|
||||||
|
|
||||||
/// The first few bytes of files generated by incremental compilation
|
/// 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
|
/// Change this if the header format changes
|
||||||
const HEADER_FORMAT_VERSION: u16 = 0;
|
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
|
/// A version string that hopefully is always different for compiler versions
|
||||||
/// with different encodings of incremental compilation artifacts. Contains
|
/// with different encodings of incremental compilation artifacts. Contains
|
||||||
/// the git commit hash.
|
/// 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) {
|
pub fn write_file_header(stream: &mut Encoder) {
|
||||||
stream.emit_raw_bytes(FILE_MAGIC);
|
stream.emit_raw_bytes(FILE_MAGIC);
|
||||||
|
|
|
@ -128,10 +128,10 @@ use std::time::{UNIX_EPOCH, SystemTime, Duration};
|
||||||
|
|
||||||
use rand::{RngCore, thread_rng};
|
use rand::{RngCore, thread_rng};
|
||||||
|
|
||||||
const LOCK_FILE_EXT: &'static str = ".lock";
|
const LOCK_FILE_EXT: &str = ".lock";
|
||||||
const DEP_GRAPH_FILENAME: &'static str = "dep-graph.bin";
|
const DEP_GRAPH_FILENAME: &str = "dep-graph.bin";
|
||||||
const WORK_PRODUCTS_FILENAME: &'static str = "work-products.bin";
|
const WORK_PRODUCTS_FILENAME: &str = "work-products.bin";
|
||||||
const QUERY_CACHE_FILENAME: &'static str = "query-cache.bin";
|
const QUERY_CACHE_FILENAME: &str = "query-cache.bin";
|
||||||
|
|
||||||
// We encode integers using the following base, so they are shorter than decimal
|
// 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
|
// or hexadecimal numbers (we want short file and directory names). Since these
|
||||||
|
|
|
@ -52,7 +52,7 @@ pub const METADATA_VERSION: u8 = 4;
|
||||||
/// This header is followed by the position of the `CrateRoot`,
|
/// This header is followed by the position of the `CrateRoot`,
|
||||||
/// which is encoded as a 32-bit big-endian unsigned integer,
|
/// which is encoded as a 32-bit big-endian unsigned integer,
|
||||||
/// and further followed by the rustc version string.
|
/// 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];
|
&[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
|
/// A value of type T referred to by its absolute position
|
||||||
|
|
|
@ -137,8 +137,8 @@ where MWF: MirWithFlowState<'tcx>,
|
||||||
block: BasicBlock,
|
block: BasicBlock,
|
||||||
mir: &Mir) -> io::Result<()> {
|
mir: &Mir) -> io::Result<()> {
|
||||||
// Header rows
|
// Header rows
|
||||||
const HDRS: [&'static str; 4] = ["ENTRY", "MIR", "BLOCK GENS", "BLOCK KILLS"];
|
const HDRS: [&str; 4] = ["ENTRY", "MIR", "BLOCK GENS", "BLOCK KILLS"];
|
||||||
const HDR_FMT: &'static str = "bgcolor=\"grey\"";
|
const HDR_FMT: &str = "bgcolor=\"grey\"";
|
||||||
write!(w, "<table><tr><td rowspan=\"{}\">", HDRS.len())?;
|
write!(w, "<table><tr><td rowspan=\"{}\">", HDRS.len())?;
|
||||||
write!(w, "{:?}", block.index())?;
|
write!(w, "{:?}", block.index())?;
|
||||||
write!(w, "</td></tr><tr>")?;
|
write!(w, "</td></tr><tr>")?;
|
||||||
|
|
|
@ -606,7 +606,7 @@ static X: i32 = 1;
|
||||||
const C: i32 = 2;
|
const C: i32 = 2;
|
||||||
|
|
||||||
// these three are not allowed:
|
// these three are not allowed:
|
||||||
const CR: &'static mut i32 = &mut C;
|
const CR: &mut i32 = &mut C;
|
||||||
static STATIC_REF: &'static mut i32 = &mut X;
|
static STATIC_REF: &'static mut i32 = &mut X;
|
||||||
static CONST_REF: &'static mut i32 = &mut C;
|
static CONST_REF: &'static mut i32 = &mut C;
|
||||||
```
|
```
|
||||||
|
@ -1163,7 +1163,7 @@ You can also have this error while using a cell type:
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
|
||||||
const A: Cell<usize> = Cell::new(1);
|
const A: Cell<usize> = Cell::new(1);
|
||||||
const B: &'static Cell<usize> = &A;
|
const B: &Cell<usize> = &A;
|
||||||
// error: cannot borrow a constant which may contain interior mutability,
|
// error: cannot borrow a constant which may contain interior mutability,
|
||||||
// create a static instead
|
// create a static instead
|
||||||
|
|
||||||
|
@ -1171,10 +1171,10 @@ const B: &'static Cell<usize> = &A;
|
||||||
struct C { a: Cell<usize> }
|
struct C { a: Cell<usize> }
|
||||||
|
|
||||||
const D: C = C { a: Cell::new(1) };
|
const D: C = C { a: Cell::new(1) };
|
||||||
const E: &'static Cell<usize> = &D.a; // error
|
const E: &Cell<usize> = &D.a; // error
|
||||||
|
|
||||||
// or:
|
// or:
|
||||||
const F: &'static C = &D; // error
|
const F: &C = &D; // error
|
||||||
```
|
```
|
||||||
|
|
||||||
This is because cell types do operations that are not thread-safe. Due to this,
|
This is because cell types do operations that are not thread-safe. Due to this,
|
||||||
|
|
|
@ -24,7 +24,7 @@ use std::path::{Path, PathBuf};
|
||||||
use super::graphviz::write_mir_fn_graphviz;
|
use super::graphviz::write_mir_fn_graphviz;
|
||||||
use transform::MirSource;
|
use transform::MirSource;
|
||||||
|
|
||||||
const INDENT: &'static str = " ";
|
const INDENT: &str = " ";
|
||||||
/// Alignment for lining up comments following MIR statements
|
/// Alignment for lining up comments following MIR statements
|
||||||
pub(crate) const ALIGN: usize = 40;
|
pub(crate) const ALIGN: usize = 40;
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,7 @@ macro_rules! supported_targets {
|
||||||
$(mod $module;)*
|
$(mod $module;)*
|
||||||
|
|
||||||
/// List of supported targets
|
/// List of supported targets
|
||||||
const TARGETS: &'static [&'static str] = &[$($triple),*];
|
const TARGETS: &[&str] = &[$($triple),*];
|
||||||
|
|
||||||
fn load_specific(target: &str) -> TargetResult {
|
fn load_specific(target: &str) -> TargetResult {
|
||||||
match target {
|
match target {
|
||||||
|
|
|
@ -53,8 +53,7 @@ macro_rules! declare_features {
|
||||||
/// Represents active features that are currently being implemented or
|
/// Represents active features that are currently being implemented or
|
||||||
/// currently being considered for addition/removal.
|
/// currently being considered for addition/removal.
|
||||||
const ACTIVE_FEATURES:
|
const ACTIVE_FEATURES:
|
||||||
&'static [(&'static str, &'static str, Option<u32>,
|
&[(&str, &str, Option<u32>, Option<Edition>, fn(&mut Features, Span))] =
|
||||||
Option<Edition>, fn(&mut Features, Span))] =
|
|
||||||
&[$((stringify!($feature), $ver, $issue, $edition, set!($feature))),+];
|
&[$((stringify!($feature), $ver, $issue, $edition, set!($feature))),+];
|
||||||
|
|
||||||
/// A set of features to be used by later passes.
|
/// A set of features to be used by later passes.
|
||||||
|
@ -769,7 +768,7 @@ pub fn is_builtin_attr(attr: &ast::Attribute) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes that have a special meaning to rustc or rustdoc
|
// Attributes that have a special meaning to rustc or rustdoc
|
||||||
pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeGate)] = &[
|
pub const BUILTIN_ATTRIBUTES: &[(&str, AttributeType, AttributeGate)] = &[
|
||||||
// Normal attributes
|
// Normal attributes
|
||||||
|
|
||||||
("warn", Normal, Ungated),
|
("warn", Normal, Ungated),
|
||||||
|
@ -1383,48 +1382,48 @@ fn leveled_feature_err<'a>(sess: &'a ParseSess, feature: &str, span: Span, issue
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const EXPLAIN_BOX_SYNTAX: &'static str =
|
const EXPLAIN_BOX_SYNTAX: &str =
|
||||||
"box expression syntax is experimental; you can call `Box::new` instead.";
|
"box expression syntax is experimental; you can call `Box::new` instead.";
|
||||||
|
|
||||||
pub const EXPLAIN_STMT_ATTR_SYNTAX: &'static str =
|
pub const EXPLAIN_STMT_ATTR_SYNTAX: &str =
|
||||||
"attributes on expressions are experimental.";
|
"attributes on expressions are experimental.";
|
||||||
|
|
||||||
pub const EXPLAIN_ASM: &'static str =
|
pub const EXPLAIN_ASM: &str =
|
||||||
"inline assembly is not stable enough for use and is subject to change";
|
"inline assembly is not stable enough for use and is subject to change";
|
||||||
|
|
||||||
pub const EXPLAIN_GLOBAL_ASM: &'static str =
|
pub const EXPLAIN_GLOBAL_ASM: &str =
|
||||||
"`global_asm!` is not stable enough for use and is subject to change";
|
"`global_asm!` is not stable enough for use and is subject to change";
|
||||||
|
|
||||||
pub const EXPLAIN_CUSTOM_TEST_FRAMEWORKS: &'static str =
|
pub const EXPLAIN_CUSTOM_TEST_FRAMEWORKS: &str =
|
||||||
"custom test frameworks are an unstable feature";
|
"custom test frameworks are an unstable feature";
|
||||||
|
|
||||||
pub const EXPLAIN_LOG_SYNTAX: &'static str =
|
pub const EXPLAIN_LOG_SYNTAX: &str =
|
||||||
"`log_syntax!` is not stable enough for use and is subject to change";
|
"`log_syntax!` is not stable enough for use and is subject to change";
|
||||||
|
|
||||||
pub const EXPLAIN_CONCAT_IDENTS: &'static str =
|
pub const EXPLAIN_CONCAT_IDENTS: &str =
|
||||||
"`concat_idents` is not stable enough for use and is subject to change";
|
"`concat_idents` is not stable enough for use and is subject to change";
|
||||||
|
|
||||||
pub const EXPLAIN_FORMAT_ARGS_NL: &'static str =
|
pub const EXPLAIN_FORMAT_ARGS_NL: &str =
|
||||||
"`format_args_nl` is only for internal language use and is subject to change";
|
"`format_args_nl` is only for internal language use and is subject to change";
|
||||||
|
|
||||||
pub const EXPLAIN_TRACE_MACROS: &'static str =
|
pub const EXPLAIN_TRACE_MACROS: &str =
|
||||||
"`trace_macros` is not stable enough for use and is subject to change";
|
"`trace_macros` is not stable enough for use and is subject to change";
|
||||||
pub const EXPLAIN_ALLOW_INTERNAL_UNSTABLE: &'static str =
|
pub const EXPLAIN_ALLOW_INTERNAL_UNSTABLE: &str =
|
||||||
"allow_internal_unstable side-steps feature gating and stability checks";
|
"allow_internal_unstable side-steps feature gating and stability checks";
|
||||||
pub const EXPLAIN_ALLOW_INTERNAL_UNSAFE: &'static str =
|
pub const EXPLAIN_ALLOW_INTERNAL_UNSAFE: &str =
|
||||||
"allow_internal_unsafe side-steps the unsafe_code lint";
|
"allow_internal_unsafe side-steps the unsafe_code lint";
|
||||||
|
|
||||||
pub const EXPLAIN_CUSTOM_DERIVE: &'static str =
|
pub const EXPLAIN_CUSTOM_DERIVE: &str =
|
||||||
"`#[derive]` for custom traits is deprecated and will be removed in the future.";
|
"`#[derive]` for custom traits is deprecated and will be removed in the future.";
|
||||||
|
|
||||||
pub const EXPLAIN_DEPR_CUSTOM_DERIVE: &'static str =
|
pub const EXPLAIN_DEPR_CUSTOM_DERIVE: &str =
|
||||||
"`#[derive]` for custom traits is deprecated and will be removed in the future. \
|
"`#[derive]` for custom traits is deprecated and will be removed in the future. \
|
||||||
Prefer using procedural macro custom derive.";
|
Prefer using procedural macro custom derive.";
|
||||||
|
|
||||||
pub const EXPLAIN_DERIVE_UNDERSCORE: &'static str =
|
pub const EXPLAIN_DERIVE_UNDERSCORE: &str =
|
||||||
"attributes of the form `#[derive_*]` are reserved for the compiler";
|
"attributes of the form `#[derive_*]` are reserved for the compiler";
|
||||||
|
|
||||||
pub const EXPLAIN_UNSIZED_TUPLE_COERCION: &'static str =
|
pub const EXPLAIN_UNSIZED_TUPLE_COERCION: &str =
|
||||||
"unsized tuple coercion is not stable enough for use and is subject to change";
|
"unsized tuple coercion is not stable enough for use and is subject to change";
|
||||||
|
|
||||||
struct PostExpansionVisitor<'a> {
|
struct PostExpansionVisitor<'a> {
|
||||||
|
|
|
@ -22,8 +22,8 @@ enum InnerAttributeParsePolicy<'a> {
|
||||||
NotPermitted { reason: &'a str },
|
NotPermitted { reason: &'a str },
|
||||||
}
|
}
|
||||||
|
|
||||||
const DEFAULT_UNEXPECTED_INNER_ATTR_ERR_MSG: &'static str = "an inner attribute is not \
|
const DEFAULT_UNEXPECTED_INNER_ATTR_ERR_MSG: &str = "an inner attribute is not \
|
||||||
permitted in this context";
|
permitted in this context";
|
||||||
|
|
||||||
impl<'a> Parser<'a> {
|
impl<'a> Parser<'a> {
|
||||||
/// Parse attributes that appear before an item
|
/// Parse attributes that appear before an item
|
||||||
|
|
|
@ -306,7 +306,7 @@ const UNICODE_ARRAY: &[(char, &str, char)] = &[
|
||||||
('>', "Fullwidth Greater-Than Sign", '>'), ];
|
('>', "Fullwidth Greater-Than Sign", '>'), ];
|
||||||
|
|
||||||
|
|
||||||
const ASCII_ARRAY: &'static [(char, &'static str)] = &[
|
const ASCII_ARRAY: &[(char, &str)] = &[
|
||||||
(' ', "Space"),
|
(' ', "Space"),
|
||||||
('_', "Underscore"),
|
('_', "Underscore"),
|
||||||
('-', "Minus/Hyphen"),
|
('-', "Minus/Hyphen"),
|
||||||
|
|
|
@ -47,7 +47,7 @@ impl State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const OPTIONS: &'static [&'static str] = &["volatile", "alignstack", "intel"];
|
const OPTIONS: &[&str] = &["volatile", "alignstack", "intel"];
|
||||||
|
|
||||||
pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt,
|
pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
|
|
|
@ -28,7 +28,7 @@ use syntax::symbol::Symbol;
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
use syntax::tokenstream;
|
use syntax::tokenstream;
|
||||||
|
|
||||||
pub const MACRO: &'static str = "global_asm";
|
pub const MACRO: &str = "global_asm";
|
||||||
|
|
||||||
pub fn expand_global_asm<'cx>(cx: &'cx mut ExtCtxt,
|
pub fn expand_global_asm<'cx>(cx: &'cx mut ExtCtxt,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
|
|
|
@ -30,8 +30,7 @@ use syntax_pos::{Span, DUMMY_SP};
|
||||||
|
|
||||||
use deriving;
|
use deriving;
|
||||||
|
|
||||||
const PROC_MACRO_KINDS: [&'static str; 3] =
|
const PROC_MACRO_KINDS: [&str; 3] = ["proc_macro_derive", "proc_macro_attribute", "proc_macro"];
|
||||||
["proc_macro_derive", "proc_macro_attribute", "proc_macro"];
|
|
||||||
|
|
||||||
struct ProcMacroDerive {
|
struct ProcMacroDerive {
|
||||||
trait_name: ast::Name,
|
trait_name: ast::Name,
|
||||||
|
|
|
@ -33,7 +33,7 @@ pub enum Edition {
|
||||||
// must be in order from oldest to newest
|
// must be in order from oldest to newest
|
||||||
pub const ALL_EDITIONS: &[Edition] = &[Edition::Edition2015, Edition::Edition2018];
|
pub const ALL_EDITIONS: &[Edition] = &[Edition::Edition2015, Edition::Edition2018];
|
||||||
|
|
||||||
pub const EDITION_NAME_LIST: &'static str = "2015|2018";
|
pub const EDITION_NAME_LIST: &str = "2015|2018";
|
||||||
|
|
||||||
pub const DEFAULT_EDITION: Edition = Edition::Edition2015;
|
pub const DEFAULT_EDITION: Edition = Edition::Edition2015;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue