diff --git a/Cargo.lock b/Cargo.lock index cedf44be85bda..905f523aa53d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -404,9 +404,9 @@ version = "0.1.0" [[package]] name = "cc" -version = "1.0.54" +version = "1.0.57" source = "registry+/~https://github.com/rust-lang/crates.io-index" -checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311" +checksum = "0fde55d2a2bfaa4c9668bbc63f531fbdeee3ffe188f4662511ce2c22b3eedebe" dependencies = [ "jobserver", ] @@ -1366,8 +1366,8 @@ checksum = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" name = "installer" version = "0.0.0" dependencies = [ + "anyhow", "clap", - "failure", "flate2", "lazy_static", "num_cpus", diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 4bec6c7791a21..fd5928d5d73c2 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -439,8 +439,6 @@ impl Step for Std { builder.cargo(compiler, Mode::Std, SourceType::InTree, target, "rustdoc"); compile::std_cargo(builder, target, compiler.stage, &mut cargo); - // Keep a whitelist so we do not build internal stdlib crates, these will be - // build by the rustc step later if enabled. cargo.arg("-p").arg(package); // Create all crate output directories first to make sure rustdoc uses // relative links. @@ -460,6 +458,10 @@ impl Step for Std { builder.run(&mut cargo.into()); }; + // Only build the following crates. While we could just iterate over the + // folder structure, that would also build internal crates that we do + // not want to show in documentation. These crates will later be + // visited by the rustc step, so internal documentation will show them. let krates = ["alloc", "core", "std", "proc_macro", "test"]; for krate in &krates { run_cargo_rustdoc_for(krate); diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index cceb794165059..e8ec575ea3746 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -9,6 +9,7 @@ //! ensure that they're always in place if needed. use std::env; +use std::env::consts::EXE_EXTENSION; use std::ffi::OsString; use std::fs::{self, File}; use std::io; @@ -252,8 +253,14 @@ impl Step for Llvm { // FIXME: if the llvm root for the build triple is overridden then we // should use llvm-tblgen from there, also should verify that it // actually exists most of the time in normal installs of LLVM. - let host = builder.llvm_out(builder.config.build).join("bin/llvm-tblgen"); - cfg.define("CMAKE_CROSSCOMPILING", "True").define("LLVM_TABLEGEN", &host); + let host_bin = builder.llvm_out(builder.config.build).join("bin"); + cfg.define("CMAKE_CROSSCOMPILING", "True"); + cfg.define("LLVM_TABLEGEN", host_bin.join("llvm-tblgen").with_extension(EXE_EXTENSION)); + cfg.define("LLVM_NM", host_bin.join("llvm-nm").with_extension(EXE_EXTENSION)); + cfg.define( + "LLVM_CONFIG_PATH", + host_bin.join("llvm-config").with_extension(EXE_EXTENSION), + ); if target.contains("netbsd") { cfg.define("CMAKE_SYSTEM_NAME", "NetBSD"); @@ -262,8 +269,6 @@ impl Step for Llvm { } else if target.contains("windows") { cfg.define("CMAKE_SYSTEM_NAME", "Windows"); } - - cfg.define("LLVM_NATIVE_BUILD", builder.llvm_out(builder.config.build).join("build")); } if let Some(ref suffix) = builder.config.llvm_version_suffix { @@ -431,6 +436,9 @@ fn configure_cmake( cflags.push_str(" -miphoneos-version-min=10.0"); } } + if builder.config.llvm_clang_cl.is_some() { + cflags.push_str(&format!(" --target={}", target)) + } cfg.define("CMAKE_C_FLAGS", cflags); let mut cxxflags = builder.cflags(target, GitRepo::Llvm).join(" "); if builder.config.llvm_static_stdcpp && !target.contains("msvc") && !target.contains("netbsd") { @@ -439,6 +447,9 @@ fn configure_cmake( if let Some(ref s) = builder.config.llvm_cxxflags { cxxflags.push_str(&format!(" {}", s)); } + if builder.config.llvm_clang_cl.is_some() { + cxxflags.push_str(&format!(" --target={}", target)) + } cfg.define("CMAKE_CXX_FLAGS", cxxflags); if let Some(ar) = builder.ar(target) { if ar.is_absolute() { @@ -484,7 +495,7 @@ impl Step for Lld { run.builder.ensure(Lld { target: run.target }); } - /// Compile LLVM for `target`. + /// Compile LLD for `target`. fn run(self, builder: &Builder<'_>) -> PathBuf { if builder.config.dry_run { return PathBuf::from("lld-out-dir-test-gen"); @@ -521,6 +532,7 @@ impl Step for Lld { // can't build on a system where your paths require `\` on Windows, but // there's probably a lot of reasons you can't do that other than this. let llvm_config_shim = env::current_exe().unwrap().with_file_name("llvm-config-wrapper"); + cfg.out_dir(&out_dir) .profile("Release") .env("LLVM_CONFIG_REAL", &llvm_config) @@ -543,7 +555,10 @@ impl Step for Lld { if target != builder.config.build { cfg.env("LLVM_CONFIG_SHIM_REPLACE", &builder.config.build) .env("LLVM_CONFIG_SHIM_REPLACE_WITH", &target) - .define("LLVM_TABLEGEN_EXE", llvm_config.with_file_name("llvm-tblgen")); + .define( + "LLVM_TABLEGEN_EXE", + llvm_config.with_file_name("llvm-tblgen").with_extension(EXE_EXTENSION), + ); } // Explicitly set C++ standard, because upstream doesn't do so @@ -595,8 +610,8 @@ impl Step for TestHelpers { } // We may have found various cross-compilers a little differently due to our - // extra configuration, so inform gcc of these compilers. Note, though, that - // on MSVC we still need gcc's detection of env vars (ugh). + // extra configuration, so inform cc of these compilers. Note, though, that + // on MSVC we still need cc's detection of env vars (ugh). if !target.contains("msvc") { if let Some(ar) = builder.ar(target) { cfg.archiver(ar); diff --git a/src/doc/book b/src/doc/book index 4e7c00bece154..84a31397b34f9 160000 --- a/src/doc/book +++ b/src/doc/book @@ -1 +1 @@ -Subproject commit 4e7c00bece1544d409312ec93467beb62b5bd0cb +Subproject commit 84a31397b34f9d405df44f2899ff17a4828dba18 diff --git a/src/doc/embedded-book b/src/doc/embedded-book index 616962ad0dd80..94d9ea8460bcb 160000 --- a/src/doc/embedded-book +++ b/src/doc/embedded-book @@ -1 +1 @@ -Subproject commit 616962ad0dd80f34d8b802da038d0aed9dd691bb +Subproject commit 94d9ea8460bcbbbfef1877b47cb930260b5849a7 diff --git a/src/doc/reference b/src/doc/reference index 04d5d5d7ba624..0ea7bc494f128 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 04d5d5d7ba624b6f5016298451f3a63d557f3260 +Subproject commit 0ea7bc494f1289234d8800bb9185021e0ad946f0 diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example index 6f94ccb48da6f..229c6945a26a5 160000 --- a/src/doc/rust-by-example +++ b/src/doc/rust-by-example @@ -1 +1 @@ -Subproject commit 6f94ccb48da6fa4ed0031290f21411cf789f7d5e +Subproject commit 229c6945a26a53a751ffa4f9cb418388c00029d3 diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md index 84e1ebe5e01f5..20c0f4a3713cc 100644 --- a/src/doc/rustdoc/src/unstable-features.md +++ b/src/doc/rustdoc/src/unstable-features.md @@ -321,7 +321,7 @@ library, as an equivalent command-line argument is provided to `rustc` when buil ### `--index-page`: provide a top-level landing page for docs This feature allows you to generate an index-page with a given markdown file. A good example of it -is the [rust documentation index](https://doc.rust-lang.org/index.html). +is the [rust documentation index](https://doc.rust-lang.org/nightly/index.html). With this, you'll have a page which you can custom as much as you want at the top of your crates. diff --git a/src/etc/test-float-parse/runtests.py b/src/etc/test-float-parse/runtests.py index fe6fd45f9a5f8..7106078f897cf 100644 --- a/src/etc/test-float-parse/runtests.py +++ b/src/etc/test-float-parse/runtests.py @@ -195,9 +195,9 @@ def main(): global MAILBOX tests = [os.path.splitext(f)[0] for f in glob('*.rs') if not f.startswith('_')] - whitelist = sys.argv[1:] - if whitelist: - tests = [test for test in tests if test in whitelist] + listed = sys.argv[1:] + if listed: + tests = [test for test in tests if test in listed] if not tests: print("Error: No tests to run") sys.exit(1) @@ -210,8 +210,6 @@ def main(): mailman.daemon = True mailman.start() for test in tests: - if whitelist and test not in whitelist: - continue run(test) MAILBOX.put(None) mailman.join() diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index d7dc2174d665f..3d51115fe01d3 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -136,8 +136,6 @@ pub use hack::to_vec; // `test_permutations` test mod hack { use crate::boxed::Box; - #[cfg(test)] - use crate::string::ToString; use crate::vec::Vec; // We shouldn't add inline attribute to this since this is used in @@ -156,9 +154,9 @@ mod hack { where T: Clone, { - let mut vector = Vec::with_capacity(s.len()); - vector.extend_from_slice(s); - vector + let mut vec = Vec::with_capacity(s.len()); + vec.extend_from_slice(s); + vec } } diff --git a/src/libcore/ffi.rs b/src/libcore/ffi.rs index ee3192eddbd06..e9689af39d51f 100644 --- a/src/libcore/ffi.rs +++ b/src/libcore/ffi.rs @@ -280,7 +280,7 @@ impl<'a, 'f: 'a> DerefMut for VaList<'a, 'f> { // within a private module. Once RFC 2145 has been implemented look into // improving this. mod sealed_trait { - /// Trait which whitelists the allowed types to be used with [VaList::arg] + /// Trait which permits the allowed types to be used with [VaList::arg]. /// /// [VaList::arg]: ../struct.VaList.html#method.arg #[unstable( diff --git a/src/librustc_codegen_llvm/attributes.rs b/src/librustc_codegen_llvm/attributes.rs index 6234ade8a1612..45d7c093e0b9d 100644 --- a/src/librustc_codegen_llvm/attributes.rs +++ b/src/librustc_codegen_llvm/attributes.rs @@ -263,7 +263,7 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty:: // Windows we end up still needing the `uwtable` attribute even if the `-C // panic=abort` flag is passed. // - // You can also find more info on why Windows is whitelisted here in: + // You can also find more info on why Windows always requires uwtables here: // https://bugzilla.mozilla.org/show_bug.cgi?id=1302078 if cx.sess().must_emit_unwind_tables() { attributes::emit_uwtable(llfn, true); @@ -343,14 +343,14 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty:: } pub fn provide(providers: &mut Providers<'_>) { - providers.target_features_whitelist = |tcx, cnum| { + providers.supported_target_features = |tcx, cnum| { assert_eq!(cnum, LOCAL_CRATE); if tcx.sess.opts.actually_rustdoc { // rustdoc needs to be able to document functions that use all the features, so - // whitelist them all + // provide them all. llvm_util::all_known_features().map(|(a, b)| (a.to_string(), b)).collect() } else { - llvm_util::target_feature_whitelist(tcx.sess) + llvm_util::supported_target_features(tcx.sess) .iter() .map(|&(a, b)| (a.to_string(), b)) .collect() diff --git a/src/librustc_codegen_llvm/back/lto.rs b/src/librustc_codegen_llvm/back/lto.rs index 9764c9a102e8a..6b02b5e8120db 100644 --- a/src/librustc_codegen_llvm/back/lto.rs +++ b/src/librustc_codegen_llvm/back/lto.rs @@ -62,11 +62,11 @@ fn prepare_lto( } }; let exported_symbols = cgcx.exported_symbols.as_ref().expect("needs exported symbols for LTO"); - let mut symbol_white_list = { - let _timer = cgcx.prof.generic_activity("LLVM_lto_generate_symbol_white_list"); + let mut symbols_below_threshold = { + let _timer = cgcx.prof.generic_activity("LLVM_lto_generate_symbols_below_threshold"); exported_symbols[&LOCAL_CRATE].iter().filter_map(symbol_filter).collect::>() }; - info!("{} symbols to preserve in this crate", symbol_white_list.len()); + info!("{} symbols to preserve in this crate", symbols_below_threshold.len()); // If we're performing LTO for the entire crate graph, then for each of our // upstream dependencies, find the corresponding rlib and load the bitcode @@ -102,8 +102,10 @@ fn prepare_lto( let exported_symbols = cgcx.exported_symbols.as_ref().expect("needs exported symbols for LTO"); { - let _timer = cgcx.prof.generic_activity("LLVM_lto_generate_symbol_white_list"); - symbol_white_list.extend(exported_symbols[&cnum].iter().filter_map(symbol_filter)); + let _timer = + cgcx.prof.generic_activity("LLVM_lto_generate_symbols_below_threshold"); + symbols_below_threshold + .extend(exported_symbols[&cnum].iter().filter_map(symbol_filter)); } let archive = ArchiveRO::open(&path).expect("wanted an rlib"); @@ -124,7 +126,7 @@ fn prepare_lto( } } - Ok((symbol_white_list, upstream_modules)) + Ok((symbols_below_threshold, upstream_modules)) } fn get_bitcode_slice_from_object_data(obj: &[u8]) -> Result<&[u8], String> { @@ -155,9 +157,17 @@ pub(crate) fn run_fat( cached_modules: Vec<(SerializedModule, WorkProduct)>, ) -> Result, FatalError> { let diag_handler = cgcx.create_diag_handler(); - let (symbol_white_list, upstream_modules) = prepare_lto(cgcx, &diag_handler)?; - let symbol_white_list = symbol_white_list.iter().map(|c| c.as_ptr()).collect::>(); - fat_lto(cgcx, &diag_handler, modules, cached_modules, upstream_modules, &symbol_white_list) + let (symbols_below_threshold, upstream_modules) = prepare_lto(cgcx, &diag_handler)?; + let symbols_below_threshold = + symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::>(); + fat_lto( + cgcx, + &diag_handler, + modules, + cached_modules, + upstream_modules, + &symbols_below_threshold, + ) } /// Performs thin LTO by performing necessary global analysis and returning two @@ -169,15 +179,23 @@ pub(crate) fn run_thin( cached_modules: Vec<(SerializedModule, WorkProduct)>, ) -> Result<(Vec>, Vec), FatalError> { let diag_handler = cgcx.create_diag_handler(); - let (symbol_white_list, upstream_modules) = prepare_lto(cgcx, &diag_handler)?; - let symbol_white_list = symbol_white_list.iter().map(|c| c.as_ptr()).collect::>(); + let (symbols_below_threshold, upstream_modules) = prepare_lto(cgcx, &diag_handler)?; + let symbols_below_threshold = + symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::>(); if cgcx.opts.cg.linker_plugin_lto.enabled() { unreachable!( "We should never reach this case if the LTO step \ is deferred to the linker" ); } - thin_lto(cgcx, &diag_handler, modules, upstream_modules, cached_modules, &symbol_white_list) + thin_lto( + cgcx, + &diag_handler, + modules, + upstream_modules, + cached_modules, + &symbols_below_threshold, + ) } pub(crate) fn prepare_thin(module: ModuleCodegen) -> (String, ThinBuffer) { @@ -192,7 +210,7 @@ fn fat_lto( modules: Vec>, cached_modules: Vec<(SerializedModule, WorkProduct)>, mut serialized_modules: Vec<(SerializedModule, CString)>, - symbol_white_list: &[*const libc::c_char], + symbols_below_threshold: &[*const libc::c_char], ) -> Result, FatalError> { let _timer = cgcx.prof.generic_activity("LLVM_fat_lto_build_monolithic_module"); info!("going for a fat lto"); @@ -306,14 +324,13 @@ fn fat_lto( drop(linker); save_temp_bitcode(&cgcx, &module, "lto.input"); - // Internalize everything that *isn't* in our whitelist to help strip out - // more modules and such + // Internalize everything below threshold to help strip out more modules and such. unsafe { - let ptr = symbol_white_list.as_ptr(); + let ptr = symbols_below_threshold.as_ptr(); llvm::LLVMRustRunRestrictionPass( llmod, ptr as *const *const libc::c_char, - symbol_white_list.len() as libc::size_t, + symbols_below_threshold.len() as libc::size_t, ); save_temp_bitcode(&cgcx, &module, "lto.after-restriction"); } @@ -395,7 +412,7 @@ fn thin_lto( modules: Vec<(String, ThinBuffer)>, serialized_modules: Vec<(SerializedModule, CString)>, cached_modules: Vec<(SerializedModule, WorkProduct)>, - symbol_white_list: &[*const libc::c_char], + symbols_below_threshold: &[*const libc::c_char], ) -> Result<(Vec>, Vec), FatalError> { let _timer = cgcx.prof.generic_activity("LLVM_thin_lto_global_analysis"); unsafe { @@ -463,8 +480,8 @@ fn thin_lto( let data = llvm::LLVMRustCreateThinLTOData( thin_modules.as_ptr(), thin_modules.len() as u32, - symbol_white_list.as_ptr(), - symbol_white_list.len() as u32, + symbols_below_threshold.as_ptr(), + symbols_below_threshold.len() as u32, ) .ok_or_else(|| write::llvm_err(&diag_handler, "failed to prepare thin LTO context"))?; diff --git a/src/librustc_codegen_llvm/llvm_util.rs b/src/librustc_codegen_llvm/llvm_util.rs index 2e2ce1544109a..b631c10334cd1 100644 --- a/src/librustc_codegen_llvm/llvm_util.rs +++ b/src/librustc_codegen_llvm/llvm_util.rs @@ -139,7 +139,7 @@ pub fn time_trace_profiler_finish(file_name: &str) { // to LLVM or the feature detection code will walk past the end of the feature // array, leading to crashes. -const ARM_WHITELIST: &[(&str, Option)] = &[ +const ARM_ALLOWED_FEATURES: &[(&str, Option)] = &[ ("aclass", Some(sym::arm_target_feature)), ("mclass", Some(sym::arm_target_feature)), ("rclass", Some(sym::arm_target_feature)), @@ -162,7 +162,7 @@ const ARM_WHITELIST: &[(&str, Option)] = &[ ("thumb-mode", Some(sym::arm_target_feature)), ]; -const AARCH64_WHITELIST: &[(&str, Option)] = &[ +const AARCH64_ALLOWED_FEATURES: &[(&str, Option)] = &[ ("fp", Some(sym::aarch64_target_feature)), ("neon", Some(sym::aarch64_target_feature)), ("sve", Some(sym::aarch64_target_feature)), @@ -180,7 +180,7 @@ const AARCH64_WHITELIST: &[(&str, Option)] = &[ ("v8.3a", Some(sym::aarch64_target_feature)), ]; -const X86_WHITELIST: &[(&str, Option)] = &[ +const X86_ALLOWED_FEATURES: &[(&str, Option)] = &[ ("adx", Some(sym::adx_target_feature)), ("aes", None), ("avx", None), @@ -224,12 +224,12 @@ const X86_WHITELIST: &[(&str, Option)] = &[ ("xsaves", None), ]; -const HEXAGON_WHITELIST: &[(&str, Option)] = &[ +const HEXAGON_ALLOWED_FEATURES: &[(&str, Option)] = &[ ("hvx", Some(sym::hexagon_target_feature)), ("hvx-length128b", Some(sym::hexagon_target_feature)), ]; -const POWERPC_WHITELIST: &[(&str, Option)] = &[ +const POWERPC_ALLOWED_FEATURES: &[(&str, Option)] = &[ ("altivec", Some(sym::powerpc_target_feature)), ("power8-altivec", Some(sym::powerpc_target_feature)), ("power9-altivec", Some(sym::powerpc_target_feature)), @@ -238,10 +238,10 @@ const POWERPC_WHITELIST: &[(&str, Option)] = &[ ("vsx", Some(sym::powerpc_target_feature)), ]; -const MIPS_WHITELIST: &[(&str, Option)] = +const MIPS_ALLOWED_FEATURES: &[(&str, Option)] = &[("fp64", Some(sym::mips_target_feature)), ("msa", Some(sym::mips_target_feature))]; -const RISCV_WHITELIST: &[(&str, Option)] = &[ +const RISCV_ALLOWED_FEATURES: &[(&str, Option)] = &[ ("m", Some(sym::riscv_target_feature)), ("a", Some(sym::riscv_target_feature)), ("c", Some(sym::riscv_target_feature)), @@ -250,7 +250,7 @@ const RISCV_WHITELIST: &[(&str, Option)] = &[ ("e", Some(sym::riscv_target_feature)), ]; -const WASM_WHITELIST: &[(&str, Option)] = &[ +const WASM_ALLOWED_FEATURES: &[(&str, Option)] = &[ ("simd128", Some(sym::wasm_target_feature)), ("atomics", Some(sym::wasm_target_feature)), ("nontrapping-fptoint", Some(sym::wasm_target_feature)), @@ -259,19 +259,18 @@ const WASM_WHITELIST: &[(&str, Option)] = &[ /// When rustdoc is running, provide a list of all known features so that all their respective /// primitives may be documented. /// -/// IMPORTANT: If you're adding another whitelist to the above lists, make sure to add it to this -/// iterator! +/// IMPORTANT: If you're adding another feature list above, make sure to add it to this iterator! pub fn all_known_features() -> impl Iterator)> { - ARM_WHITELIST - .iter() + std::iter::empty() + .chain(ARM_ALLOWED_FEATURES.iter()) + .chain(AARCH64_ALLOWED_FEATURES.iter()) + .chain(X86_ALLOWED_FEATURES.iter()) + .chain(HEXAGON_ALLOWED_FEATURES.iter()) + .chain(POWERPC_ALLOWED_FEATURES.iter()) + .chain(MIPS_ALLOWED_FEATURES.iter()) + .chain(RISCV_ALLOWED_FEATURES.iter()) + .chain(WASM_ALLOWED_FEATURES.iter()) .cloned() - .chain(AARCH64_WHITELIST.iter().cloned()) - .chain(X86_WHITELIST.iter().cloned()) - .chain(HEXAGON_WHITELIST.iter().cloned()) - .chain(POWERPC_WHITELIST.iter().cloned()) - .chain(MIPS_WHITELIST.iter().cloned()) - .chain(RISCV_WHITELIST.iter().cloned()) - .chain(WASM_WHITELIST.iter().cloned()) } pub fn to_llvm_feature<'a>(sess: &Session, s: &'a str) -> &'a str { @@ -289,7 +288,7 @@ pub fn to_llvm_feature<'a>(sess: &Session, s: &'a str) -> &'a str { pub fn target_features(sess: &Session) -> Vec { let target_machine = create_informational_target_machine(sess); - target_feature_whitelist(sess) + supported_target_features(sess) .iter() .filter_map(|&(feature, gate)| { if UnstableFeatures::from_environment().is_nightly_build() || gate.is_none() { @@ -307,16 +306,16 @@ pub fn target_features(sess: &Session) -> Vec { .collect() } -pub fn target_feature_whitelist(sess: &Session) -> &'static [(&'static str, Option)] { +pub fn supported_target_features(sess: &Session) -> &'static [(&'static str, Option)] { match &*sess.target.target.arch { - "arm" => ARM_WHITELIST, - "aarch64" => AARCH64_WHITELIST, - "x86" | "x86_64" => X86_WHITELIST, - "hexagon" => HEXAGON_WHITELIST, - "mips" | "mips64" => MIPS_WHITELIST, - "powerpc" | "powerpc64" => POWERPC_WHITELIST, - "riscv32" | "riscv64" => RISCV_WHITELIST, - "wasm32" => WASM_WHITELIST, + "arm" => ARM_ALLOWED_FEATURES, + "aarch64" => AARCH64_ALLOWED_FEATURES, + "x86" | "x86_64" => X86_ALLOWED_FEATURES, + "hexagon" => HEXAGON_ALLOWED_FEATURES, + "mips" | "mips64" => MIPS_ALLOWED_FEATURES, + "powerpc" | "powerpc64" => POWERPC_ALLOWED_FEATURES, + "riscv32" | "riscv64" => RISCV_ALLOWED_FEATURES, + "wasm32" => WASM_ALLOWED_FEATURES, _ => &[], } } diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index 54f55c806d035..43d351342ccad 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -1176,10 +1176,10 @@ impl<'a> Linker for WasmLd<'a> { self.cmd.arg("--export").arg(&sym); } - // LLD will hide these otherwise-internal symbols since our `--export` - // list above is a whitelist of what to export. Various bits and pieces - // of tooling use this, so be sure these symbols make their way out of - // the linker as well. + // LLD will hide these otherwise-internal symbols since it only exports + // symbols explicity passed via the `--export` flags above and hides all + // others. Various bits and pieces of tooling use this, so be sure these + // symbols make their way out of the linker as well. self.cmd.arg("--export=__heap_base"); self.cmd.arg("--export=__data_end"); } diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index 5b14258bd25be..f0bae2aaed2f4 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -842,10 +842,9 @@ impl CrateInfo { } } - // No need to look for lang items that are whitelisted and don't - // actually need to exist. + // No need to look for lang items that don't actually need to exist. let missing = - missing.iter().cloned().filter(|&l| !lang_items::whitelisted(tcx, l)).collect(); + missing.iter().cloned().filter(|&l| !lang_items::not_required(tcx, l)).collect(); info.missing_lang_items.insert(cnum, missing); } diff --git a/src/librustc_error_codes/error_codes/E0570.md b/src/librustc_error_codes/error_codes/E0570.md index bf9615f87387d..355e71ffb4329 100644 --- a/src/librustc_error_codes/error_codes/E0570.md +++ b/src/librustc_error_codes/error_codes/E0570.md @@ -1,6 +1,6 @@ The requested ABI is unsupported by the current target. -The rust compiler maintains for each target a blacklist of ABIs unsupported on +The rust compiler maintains for each target a list of unsupported ABIs on that target. If an ABI is present in such a list this usually means that the target / ABI combination is currently unsupported by llvm. diff --git a/src/librustc_expand/base.rs b/src/librustc_expand/base.rs index db9293bddeb7d..3e48224ef9f20 100644 --- a/src/librustc_expand/base.rs +++ b/src/librustc_expand/base.rs @@ -735,7 +735,7 @@ pub struct SyntaxExtension { pub kind: SyntaxExtensionKind, /// Span of the macro definition. pub span: Span, - /// Whitelist of unstable features that are treated as stable inside this macro. + /// List of unstable features that are treated as stable inside this macro. pub allow_internal_unstable: Option>, /// Suppresses the `unsafe_code` lint for code produced by this macro. pub allow_internal_unsafe: bool, diff --git a/src/librustc_feature/builtin_attrs.rs b/src/librustc_feature/builtin_attrs.rs index c9a34f033758b..4e2aea34fe7fb 100644 --- a/src/librustc_feature/builtin_attrs.rs +++ b/src/librustc_feature/builtin_attrs.rs @@ -47,7 +47,7 @@ pub enum AttributeType { /// Builtin attribute that may not be consumed by the compiler /// before the unused_attribute check. These attributes /// will be ignored by the unused_attribute lint - Whitelisted, + AssumedUsed, /// Builtin attribute that is only allowed at the crate level CrateLevel, @@ -202,7 +202,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ ungated!(allow, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#)), ungated!(forbid, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#)), ungated!(deny, Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#)), - ungated!(must_use, Whitelisted, template!(Word, NameValueStr: "reason")), + ungated!(must_use, AssumedUsed, template!(Word, NameValueStr: "reason")), // FIXME(#14407) ungated!( deprecated, Normal, @@ -220,16 +220,16 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // ABI, linking, symbols, and FFI ungated!( - link, Whitelisted, + link, AssumedUsed, template!(List: r#"name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...""#), ), - ungated!(link_name, Whitelisted, template!(NameValueStr: "name")), + ungated!(link_name, AssumedUsed, template!(NameValueStr: "name")), ungated!(no_link, Normal, template!(Word)), ungated!(repr, Normal, template!(List: "C")), - ungated!(export_name, Whitelisted, template!(NameValueStr: "name")), - ungated!(link_section, Whitelisted, template!(NameValueStr: "name")), - ungated!(no_mangle, Whitelisted, template!(Word)), - ungated!(used, Whitelisted, template!(Word)), + ungated!(export_name, AssumedUsed, template!(NameValueStr: "name")), + ungated!(link_section, AssumedUsed, template!(NameValueStr: "name")), + ungated!(no_mangle, AssumedUsed, template!(Word)), + ungated!(used, AssumedUsed, template!(Word)), // Limits: ungated!(recursion_limit, CrateLevel, template!(NameValueStr: "N")), @@ -249,40 +249,40 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ ungated!(path, Normal, template!(NameValueStr: "file")), ungated!(no_std, CrateLevel, template!(Word)), ungated!(no_implicit_prelude, Normal, template!(Word)), - ungated!(non_exhaustive, Whitelisted, template!(Word)), + ungated!(non_exhaustive, AssumedUsed, template!(Word)), // Runtime - ungated!(windows_subsystem, Whitelisted, template!(NameValueStr: "windows|console")), + ungated!(windows_subsystem, AssumedUsed, template!(NameValueStr: "windows|console")), ungated!(panic_handler, Normal, template!(Word)), // RFC 2070 // Code generation: - ungated!(inline, Whitelisted, template!(Word, List: "always|never")), - ungated!(cold, Whitelisted, template!(Word)), - ungated!(no_builtins, Whitelisted, template!(Word)), - ungated!(target_feature, Whitelisted, template!(List: r#"enable = "name""#)), - ungated!(track_caller, Whitelisted, template!(Word)), + ungated!(inline, AssumedUsed, template!(Word, List: "always|never")), + ungated!(cold, AssumedUsed, template!(Word)), + ungated!(no_builtins, AssumedUsed, template!(Word)), + ungated!(target_feature, AssumedUsed, template!(List: r#"enable = "name""#)), + ungated!(track_caller, AssumedUsed, template!(Word)), gated!( - no_sanitize, Whitelisted, + no_sanitize, AssumedUsed, template!(List: "address, memory, thread"), experimental!(no_sanitize) ), - // FIXME: #14408 whitelist docs since rustdoc looks at them - ungated!(doc, Whitelisted, template!(List: "hidden|inline|...", NameValueStr: "string")), + // FIXME: #14408 assume docs are used since rustdoc looks at them. + ungated!(doc, AssumedUsed, template!(List: "hidden|inline|...", NameValueStr: "string")), // ========================================================================== // Unstable attributes: // ========================================================================== // Linking: - gated!(naked, Whitelisted, template!(Word), naked_functions, experimental!(naked)), + gated!(naked, AssumedUsed, template!(Word), naked_functions, experimental!(naked)), gated!( link_args, Normal, template!(NameValueStr: "args"), "the `link_args` attribute is experimental and not portable across platforms, \ it is recommended to use `#[link(name = \"foo\")] instead", ), gated!( - link_ordinal, Whitelisted, template!(List: "ordinal"), raw_dylib, + link_ordinal, AssumedUsed, template!(List: "ordinal"), raw_dylib, experimental!(link_ordinal) ), @@ -321,19 +321,19 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // RFC #1268 gated!(marker, Normal, template!(Word), marker_trait_attr, experimental!(marker)), gated!( - thread_local, Whitelisted, template!(Word), + thread_local, AssumedUsed, template!(Word), "`#[thread_local]` is an experimental feature, and does not currently handle destructors", ), gated!(no_core, CrateLevel, template!(Word), experimental!(no_core)), // RFC 2412 gated!( - optimize, Whitelisted, template!(List: "size|speed"), optimize_attribute, + optimize, AssumedUsed, template!(List: "size|speed"), optimize_attribute, experimental!(optimize), ), - gated!(ffi_returns_twice, Whitelisted, template!(Word), experimental!(ffi_returns_twice)), - gated!(ffi_pure, Whitelisted, template!(Word), experimental!(ffi_pure)), - gated!(ffi_const, Whitelisted, template!(Word), experimental!(ffi_const)), + gated!(ffi_returns_twice, AssumedUsed, template!(Word), experimental!(ffi_returns_twice)), + gated!(ffi_pure, AssumedUsed, template!(Word), experimental!(ffi_pure)), + gated!(ffi_const, AssumedUsed, template!(Word), experimental!(ffi_const)), gated!( register_attr, CrateLevel, template!(List: "attr1, attr2, ..."), experimental!(register_attr), @@ -351,22 +351,22 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // FIXME(#14407) -- only looked at on-demand so we can't // guarantee they'll have already been checked. ungated!( - rustc_deprecated, Whitelisted, + rustc_deprecated, AssumedUsed, template!(List: r#"since = "version", reason = "...""#) ), // FIXME(#14407) - ungated!(stable, Whitelisted, template!(List: r#"feature = "name", since = "version""#)), + ungated!(stable, AssumedUsed, template!(List: r#"feature = "name", since = "version""#)), // FIXME(#14407) ungated!( - unstable, Whitelisted, + unstable, AssumedUsed, template!(List: r#"feature = "name", reason = "...", issue = "N""#), ), // FIXME(#14407) - ungated!(rustc_const_unstable, Whitelisted, template!(List: r#"feature = "name""#)), + ungated!(rustc_const_unstable, AssumedUsed, template!(List: r#"feature = "name""#)), // FIXME(#14407) - ungated!(rustc_const_stable, Whitelisted, template!(List: r#"feature = "name""#)), + ungated!(rustc_const_stable, AssumedUsed, template!(List: r#"feature = "name""#)), gated!( - allow_internal_unstable, Whitelisted, template!(Word, List: "feat1, feat2, ..."), + allow_internal_unstable, AssumedUsed, template!(Word, List: "feat1, feat2, ..."), "allow_internal_unstable side-steps feature gating and stability checks", ), gated!( @@ -378,7 +378,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // Internal attributes: Type system related: // ========================================================================== - gated!(fundamental, Whitelisted, template!(Word), experimental!(fundamental)), + gated!(fundamental, AssumedUsed, template!(Word), experimental!(fundamental)), gated!( may_dangle, Normal, template!(Word), dropck_eyepatch, "`may_dangle` has unstable semantics and may be removed in the future", @@ -388,30 +388,30 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // Internal attributes: Runtime related: // ========================================================================== - rustc_attr!(rustc_allocator, Whitelisted, template!(Word), IMPL_DETAIL), - rustc_attr!(rustc_allocator_nounwind, Whitelisted, template!(Word), IMPL_DETAIL), + rustc_attr!(rustc_allocator, AssumedUsed, template!(Word), IMPL_DETAIL), + rustc_attr!(rustc_allocator_nounwind, AssumedUsed, template!(Word), IMPL_DETAIL), gated!(alloc_error_handler, Normal, template!(Word), experimental!(alloc_error_handler)), gated!( - default_lib_allocator, Whitelisted, template!(Word), allocator_internals, + default_lib_allocator, AssumedUsed, template!(Word), allocator_internals, experimental!(default_lib_allocator), ), gated!( needs_allocator, Normal, template!(Word), allocator_internals, experimental!(needs_allocator), ), - gated!(panic_runtime, Whitelisted, template!(Word), experimental!(panic_runtime)), - gated!(needs_panic_runtime, Whitelisted, template!(Word), experimental!(needs_panic_runtime)), + gated!(panic_runtime, AssumedUsed, template!(Word), experimental!(panic_runtime)), + gated!(needs_panic_runtime, AssumedUsed, template!(Word), experimental!(needs_panic_runtime)), gated!( - unwind, Whitelisted, template!(List: "allowed|aborts"), unwind_attributes, + unwind, AssumedUsed, template!(List: "allowed|aborts"), unwind_attributes, experimental!(unwind), ), gated!( - compiler_builtins, Whitelisted, template!(Word), + compiler_builtins, AssumedUsed, template!(Word), "the `#[compiler_builtins]` attribute is used to identify the `compiler_builtins` crate \ which contains compiler-rt intrinsics and will never be stable", ), gated!( - profiler_runtime, Whitelisted, template!(Word), + profiler_runtime, AssumedUsed, template!(Word), "the `#[profiler_runtime]` attribute is used to identify the `profiler_builtins` crate \ which contains the profiler runtime and will never be stable", ), @@ -421,19 +421,19 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // ========================================================================== gated!( - linkage, Whitelisted, template!(NameValueStr: "external|internal|..."), + linkage, AssumedUsed, template!(NameValueStr: "external|internal|..."), "the `linkage` attribute is experimental and not portable across platforms", ), - rustc_attr!(rustc_std_internal_symbol, Whitelisted, template!(Word), INTERNAL_UNSTABLE), + rustc_attr!(rustc_std_internal_symbol, AssumedUsed, template!(Word), INTERNAL_UNSTABLE), // ========================================================================== // Internal attributes, Macro related: // ========================================================================== - rustc_attr!(rustc_builtin_macro, Whitelisted, template!(Word), IMPL_DETAIL), + rustc_attr!(rustc_builtin_macro, AssumedUsed, template!(Word), IMPL_DETAIL), rustc_attr!(rustc_proc_macro_decls, Normal, template!(Word), INTERNAL_UNSTABLE), rustc_attr!( - rustc_macro_transparency, Whitelisted, + rustc_macro_transparency, AssumedUsed, template!(NameValueStr: "transparent|semitransparent|opaque"), "used internally for testing macro hygiene", ), @@ -443,40 +443,40 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // ========================================================================== rustc_attr!( - rustc_on_unimplemented, Whitelisted, + rustc_on_unimplemented, AssumedUsed, template!( List: r#"/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...""#, NameValueStr: "message" ), INTERNAL_UNSTABLE ), - // Whitelists "identity-like" conversion methods to suggest on type mismatch. - rustc_attr!(rustc_conversion_suggestion, Whitelisted, template!(Word), INTERNAL_UNSTABLE), + // Enumerates "identity-like" conversion methods to suggest on type mismatch. + rustc_attr!(rustc_conversion_suggestion, AssumedUsed, template!(Word), INTERNAL_UNSTABLE), // ========================================================================== // Internal attributes, Const related: // ========================================================================== - rustc_attr!(rustc_promotable, Whitelisted, template!(Word), IMPL_DETAIL), - rustc_attr!(rustc_allow_const_fn_ptr, Whitelisted, template!(Word), IMPL_DETAIL), - rustc_attr!(rustc_args_required_const, Whitelisted, template!(List: "N"), INTERNAL_UNSTABLE), + rustc_attr!(rustc_promotable, AssumedUsed, template!(Word), IMPL_DETAIL), + rustc_attr!(rustc_allow_const_fn_ptr, AssumedUsed, template!(Word), IMPL_DETAIL), + rustc_attr!(rustc_args_required_const, AssumedUsed, template!(List: "N"), INTERNAL_UNSTABLE), // ========================================================================== // Internal attributes, Layout related: // ========================================================================== rustc_attr!( - rustc_layout_scalar_valid_range_start, Whitelisted, template!(List: "value"), + rustc_layout_scalar_valid_range_start, AssumedUsed, template!(List: "value"), "the `#[rustc_layout_scalar_valid_range_start]` attribute is just used to enable \ niche optimizations in libcore and will never be stable", ), rustc_attr!( - rustc_layout_scalar_valid_range_end, Whitelisted, template!(List: "value"), + rustc_layout_scalar_valid_range_end, AssumedUsed, template!(List: "value"), "the `#[rustc_layout_scalar_valid_range_end]` attribute is just used to enable \ niche optimizations in libcore and will never be stable", ), rustc_attr!( - rustc_nonnull_optimization_guaranteed, Whitelisted, template!(Word), + rustc_nonnull_optimization_guaranteed, AssumedUsed, template!(Word), "the `#[rustc_nonnull_optimization_guaranteed]` attribute is just used to enable \ niche optimizations in libcore and will never be stable", ), @@ -501,7 +501,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ ), gated!( // Used in resolve: - prelude_import, Whitelisted, template!(Word), + prelude_import, AssumedUsed, template!(Word), "`#[prelude_import]` is for use by rustc only", ), gated!( @@ -509,7 +509,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ "unboxed_closures are still evolving", ), rustc_attr!( - rustc_inherit_overflow_checks, Whitelisted, template!(Word), + rustc_inherit_overflow_checks, AssumedUsed, template!(Word), "the `#[rustc_inherit_overflow_checks]` attribute is just used to control \ overflow checking behavior of several libcore functions that are inlined \ across crates and will never be stable", @@ -540,42 +540,42 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ rustc_attr!(TEST, rustc_layout, Normal, template!(List: "field1, field2, ...")), rustc_attr!(TEST, rustc_regions, Normal, template!(Word)), rustc_attr!( - TEST, rustc_error, Whitelisted, + TEST, rustc_error, AssumedUsed, template!(Word, List: "delay_span_bug_from_inside_query") ), - rustc_attr!(TEST, rustc_dump_user_substs, Whitelisted, template!(Word)), - rustc_attr!(TEST, rustc_if_this_changed, Whitelisted, template!(Word, List: "DepNode")), - rustc_attr!(TEST, rustc_then_this_would_need, Whitelisted, template!(List: "DepNode")), + rustc_attr!(TEST, rustc_dump_user_substs, AssumedUsed, template!(Word)), + rustc_attr!(TEST, rustc_if_this_changed, AssumedUsed, template!(Word, List: "DepNode")), + rustc_attr!(TEST, rustc_then_this_would_need, AssumedUsed, template!(List: "DepNode")), rustc_attr!( - TEST, rustc_dirty, Whitelisted, + TEST, rustc_dirty, AssumedUsed, template!(List: r#"cfg = "...", /*opt*/ label = "...", /*opt*/ except = "...""#), ), rustc_attr!( - TEST, rustc_clean, Whitelisted, + TEST, rustc_clean, AssumedUsed, template!(List: r#"cfg = "...", /*opt*/ label = "...", /*opt*/ except = "...""#), ), rustc_attr!( - TEST, rustc_partition_reused, Whitelisted, + TEST, rustc_partition_reused, AssumedUsed, template!(List: r#"cfg = "...", module = "...""#), ), rustc_attr!( - TEST, rustc_partition_codegened, Whitelisted, + TEST, rustc_partition_codegened, AssumedUsed, template!(List: r#"cfg = "...", module = "...""#), ), rustc_attr!( - TEST, rustc_expected_cgu_reuse, Whitelisted, + TEST, rustc_expected_cgu_reuse, AssumedUsed, template!(List: r#"cfg = "...", module = "...", kind = "...""#), ), - rustc_attr!(TEST, rustc_synthetic, Whitelisted, template!(Word)), - rustc_attr!(TEST, rustc_symbol_name, Whitelisted, template!(Word)), - rustc_attr!(TEST, rustc_def_path, Whitelisted, template!(Word)), - rustc_attr!(TEST, rustc_mir, Whitelisted, template!(List: "arg1, arg2, ...")), - rustc_attr!(TEST, rustc_dump_program_clauses, Whitelisted, template!(Word)), - rustc_attr!(TEST, rustc_dump_env_program_clauses, Whitelisted, template!(Word)), - rustc_attr!(TEST, rustc_object_lifetime_default, Whitelisted, template!(Word)), + rustc_attr!(TEST, rustc_synthetic, AssumedUsed, template!(Word)), + rustc_attr!(TEST, rustc_symbol_name, AssumedUsed, template!(Word)), + rustc_attr!(TEST, rustc_def_path, AssumedUsed, template!(Word)), + rustc_attr!(TEST, rustc_mir, AssumedUsed, template!(List: "arg1, arg2, ...")), + rustc_attr!(TEST, rustc_dump_program_clauses, AssumedUsed, template!(Word)), + rustc_attr!(TEST, rustc_dump_env_program_clauses, AssumedUsed, template!(Word)), + rustc_attr!(TEST, rustc_object_lifetime_default, AssumedUsed, template!(Word)), rustc_attr!(TEST, rustc_dummy, Normal, template!(Word /* doesn't matter*/)), gated!( - omit_gdb_pretty_printer_section, Whitelisted, template!(Word), + omit_gdb_pretty_printer_section, AssumedUsed, template!(Word), "the `#[omit_gdb_pretty_printer_section]` attribute is just used for the Rust test suite", ), ]; diff --git a/src/librustc_incremental/persist/dirty_clean.rs b/src/librustc_incremental/persist/dirty_clean.rs index 2ee95174dffe6..043aff90ce404 100644 --- a/src/librustc_incremental/persist/dirty_clean.rs +++ b/src/librustc_incremental/persist/dirty_clean.rs @@ -168,7 +168,7 @@ pub fn check_dirty_clean_annotations(tcx: TyCtxt<'_>) { // Note that we cannot use the existing "unused attribute"-infrastructure // here, since that is running before codegen. This is also the reason why - // all codegen-specific attributes are `Whitelisted` in rustc_ast::feature_gate. + // all codegen-specific attributes are `AssumedUsed` in rustc_ast::feature_gate. all_attrs.report_unchecked_attrs(&dirty_clean_visitor.checked_attrs); }) } diff --git a/src/librustc_interface/util.rs b/src/librustc_interface/util.rs index 924908e572487..278d1cd6dadfe 100644 --- a/src/librustc_interface/util.rs +++ b/src/librustc_interface/util.rs @@ -38,8 +38,8 @@ use std::{panic, thread}; /// Adds `target_feature = "..."` cfgs for a variety of platform /// specific features (SSE, NEON etc.). /// -/// This is performed by checking whether a whitelisted set of -/// features is available on the target machine, by querying LLVM. +/// This is performed by checking whether a set of permitted features +/// is available on the target machine, by querying LLVM. pub fn add_configuration( cfg: &mut CrateConfig, sess: &mut Session, diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 45a86cf2cc6cc..b7610b08b87fc 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -63,7 +63,7 @@ use rustc_middle::ty::query::Providers; use rustc_middle::ty::TyCtxt; use rustc_session::lint::builtin::{ BARE_TRAIT_OBJECTS, ELIDED_LIFETIMES_IN_PATHS, EXPLICIT_OUTLIVES_REQUIREMENTS, - INTRA_DOC_LINK_RESOLUTION_FAILURE, INVALID_CODEBLOCK_ATTRIBUTE, MISSING_DOC_CODE_EXAMPLES, + INTRA_DOC_LINK_RESOLUTION_FAILURE, INVALID_CODEBLOCK_ATTRIBUTES, MISSING_DOC_CODE_EXAMPLES, PRIVATE_DOC_TESTS, }; use rustc_span::symbol::{Ident, Symbol}; @@ -305,7 +305,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) { add_lint_group!( "rustdoc", INTRA_DOC_LINK_RESOLUTION_FAILURE, - INVALID_CODEBLOCK_ATTRIBUTE, + INVALID_CODEBLOCK_ATTRIBUTES, MISSING_DOC_CODE_EXAMPLES, PRIVATE_DOC_TESTS ); diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index c407f608a14c5..2431f7ba54b36 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -287,8 +287,8 @@ impl<'tcx> LateLintPass<'tcx> for UnusedAttributes { let attr_info = attr.ident().and_then(|ident| self.builtin_attributes.get(&ident.name)); if let Some(&&(name, ty, ..)) = attr_info { - if let AttributeType::Whitelisted = ty { - debug!("{:?} is Whitelisted", name); + if let AttributeType::AssumedUsed = ty { + debug!("{:?} is AssumedUsed", name); return; } } diff --git a/src/librustc_metadata/rmeta/decoder.rs b/src/librustc_metadata/rmeta/decoder.rs index 1ac16e0d31193..4746e53ce59a9 100644 --- a/src/librustc_metadata/rmeta/decoder.rs +++ b/src/librustc_metadata/rmeta/decoder.rs @@ -1386,9 +1386,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { let constness = match self.kind(id) { EntryKind::AssocFn(data) => data.decode(self).fn_data.constness, EntryKind::Fn(data) => data.decode(self).constness, - // Some intrinsics can be const fn. While we could recompute this (at least until we - // stop having hardcoded whitelists and move to stability attributes), it seems cleaner - // to treat all const fns equally. EntryKind::ForeignFn(data) => data.decode(self).constness, EntryKind::Variant(..) | EntryKind::Struct(..) => hir::Constness::Const, _ => hir::Constness::NotConst, diff --git a/src/librustc_middle/lint.rs b/src/librustc_middle/lint.rs index bb62c1bb82428..3f0939239e85c 100644 --- a/src/librustc_middle/lint.rs +++ b/src/librustc_middle/lint.rs @@ -230,8 +230,9 @@ pub fn struct_lint_level<'s, 'd>( err.allow_suggestions(false); // If this is a future incompatible lint it'll become a hard error, so - // we have to emit *something*. Also allow lints to whitelist themselves - // on a case-by-case basis for emission in a foreign macro. + // we have to emit *something*. Also, if this lint occurs in the + // expansion of a macro from an external crate, allow individual lints + // to opt-out from being reported. if future_incompatible.is_none() && !lint.report_in_external_macro { err.cancel(); // Don't continue further, since we don't want to have diff --git a/src/librustc_middle/middle/lang_items.rs b/src/librustc_middle/middle/lang_items.rs index 0f98c338c16b1..07e680686ec8a 100644 --- a/src/librustc_middle/middle/lang_items.rs +++ b/src/librustc_middle/middle/lang_items.rs @@ -48,7 +48,7 @@ impl<'tcx> TyCtxt<'tcx> { /// Not all lang items are always required for each compilation, particularly in /// the case of panic=abort. In these situations some lang items are injected by /// crates and don't actually need to be defined in libstd. -pub fn whitelisted(tcx: TyCtxt<'_>, lang_item: LangItem) -> bool { +pub fn not_required(tcx: TyCtxt<'_>, lang_item: LangItem) -> bool { // If we're not compiling with unwinding, we won't actually need these // symbols. Other panic runtimes ensure that the relevant symbols are // available to link things together, but they're never exercised. diff --git a/src/librustc_middle/query/mod.rs b/src/librustc_middle/query/mod.rs index 3285be555d30f..0faf389aa385c 100644 --- a/src/librustc_middle/query/mod.rs +++ b/src/librustc_middle/query/mod.rs @@ -1413,10 +1413,10 @@ rustc_queries! { } Other { - query target_features_whitelist(_: CrateNum) -> FxHashMap> { + query supported_target_features(_: CrateNum) -> FxHashMap> { storage(ArenaCacheSelector<'tcx>) eval_always - desc { "looking up the whitelist of target features" } + desc { "looking up supported target features" } } // Get an estimate of the size of an InstanceDef based on its MIR for CGU partitioning. diff --git a/src/librustc_mir/const_eval/fn_queries.rs b/src/librustc_mir/const_eval/fn_queries.rs index 74f8a1cb6d124..a05af5a6c30db 100644 --- a/src/librustc_mir/const_eval/fn_queries.rs +++ b/src/librustc_mir/const_eval/fn_queries.rs @@ -88,7 +88,7 @@ pub fn is_parent_const_impl_raw(tcx: TyCtxt<'_>, hir_id: hir::HirId) -> bool { } /// Checks whether the function has a `const` modifier or, in case it is an intrinsic, whether -/// said intrinsic is on the whitelist for being const callable. +/// said intrinsic has a `rustc_const_{un,}stable` attribute. fn is_const_fn_raw(tcx: TyCtxt<'_>, def_id: DefId) -> bool { let hir_id = tcx.hir().as_local_hir_id(def_id.expect_local()); diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs index ab836595a7acc..f95ac309424d0 100644 --- a/src/librustc_mir/interpret/validity.rs +++ b/src/librustc_mir/interpret/validity.rs @@ -45,7 +45,7 @@ macro_rules! throw_validation_failure { /// If $e throws an error matching the pattern, throw a validation failure. /// Other errors are passed back to the caller, unchanged -- and if they reach the root of /// the visitor, we make sure only validation errors and `InvalidProgram` errors are left. -/// This lets you use the patterns as a kind of validation whitelist, asserting which errors +/// This lets you use the patterns as a kind of validation list, asserting which errors /// can possibly happen: /// /// ``` diff --git a/src/librustc_passes/check_attr.rs b/src/librustc_passes/check_attr.rs index ef84f251390e6..fee63b1ee524e 100644 --- a/src/librustc_passes/check_attr.rs +++ b/src/librustc_passes/check_attr.rs @@ -292,6 +292,8 @@ impl CheckAttrVisitor<'tcx> { | sym::u32 | sym::i64 | sym::u64 + | sym::i128 + | sym::u128 | sym::isize | sym::usize => { int_reprs += 1; diff --git a/src/librustc_passes/weak_lang_items.rs b/src/librustc_passes/weak_lang_items.rs index f2f07b5d4fb26..a3557f0d3189b 100644 --- a/src/librustc_passes/weak_lang_items.rs +++ b/src/librustc_passes/weak_lang_items.rs @@ -7,7 +7,7 @@ use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc_hir::lang_items; use rustc_hir::lang_items::ITEM_REFS; use rustc_hir::weak_lang_items::WEAK_ITEMS_REFS; -use rustc_middle::middle::lang_items::whitelisted; +use rustc_middle::middle::lang_items::not_required; use rustc_middle::ty::TyCtxt; use rustc_session::config::CrateType; use rustc_span::symbol::sym; @@ -59,7 +59,7 @@ fn verify<'tcx>(tcx: TyCtxt<'tcx>, items: &lang_items::LanguageItems) { } for (name, &item) in WEAK_ITEMS_REFS.iter() { - if missing.contains(&item) && !whitelisted(tcx, item) && items.require(item).is_err() { + if missing.contains(&item) && !not_required(tcx, item) && items.require(item).is_err() { if item == lang_items::PanicImplLangItem { tcx.sess.err("`#[panic_handler]` function required, but not found"); } else if item == lang_items::OomLangItem { diff --git a/src/librustc_resolve/imports.rs b/src/librustc_resolve/imports.rs index ded0ee8a96699..4595a96ce24f5 100644 --- a/src/librustc_resolve/imports.rs +++ b/src/librustc_resolve/imports.rs @@ -262,8 +262,8 @@ impl<'a> Resolver<'a> { } let check_usable = |this: &mut Self, binding: &'a NameBinding<'a>| { - if let Some(blacklisted_binding) = this.blacklisted_binding { - if ptr::eq(binding, blacklisted_binding) { + if let Some(unusable_binding) = this.unusable_binding { + if ptr::eq(binding, unusable_binding) { return Err((Determined, Weak::No)); } } @@ -278,12 +278,12 @@ impl<'a> Resolver<'a> { return resolution .binding .and_then(|binding| { - // If the primary binding is blacklisted, search further and return the shadowed - // glob binding if it exists. What we really want here is having two separate - // scopes in a module - one for non-globs and one for globs, but until that's done - // use this hack to avoid inconsistent resolution ICEs during import validation. - if let Some(blacklisted_binding) = self.blacklisted_binding { - if ptr::eq(binding, blacklisted_binding) { + // If the primary binding is unusable, search further and return the shadowed glob + // binding if it exists. What we really want here is having two separate scopes in + // a module - one for non-globs and one for globs, but until that's done use this + // hack to avoid inconsistent resolution ICEs during import validation. + if let Some(unusable_binding) = self.unusable_binding { + if ptr::eq(binding, unusable_binding) { return resolution.shadowed_glob; } } @@ -875,9 +875,9 @@ impl<'a, 'b> ImportResolver<'a, 'b> { /// consolidate multiple unresolved import errors into a single diagnostic. fn finalize_import(&mut self, import: &'b Import<'b>) -> Option { let orig_vis = import.vis.replace(ty::Visibility::Invisible); - let orig_blacklisted_binding = match &import.kind { + let orig_unusable_binding = match &import.kind { ImportKind::Single { target_bindings, .. } => { - Some(mem::replace(&mut self.r.blacklisted_binding, target_bindings[TypeNS].get())) + Some(mem::replace(&mut self.r.unusable_binding, target_bindings[TypeNS].get())) } _ => None, }; @@ -891,8 +891,8 @@ impl<'a, 'b> ImportResolver<'a, 'b> { import.crate_lint(), ); let no_ambiguity = self.r.ambiguity_errors.len() == prev_ambiguity_errors_len; - if let Some(orig_blacklisted_binding) = orig_blacklisted_binding { - self.r.blacklisted_binding = orig_blacklisted_binding; + if let Some(orig_unusable_binding) = orig_unusable_binding { + self.r.unusable_binding = orig_unusable_binding; } import.vis.set(orig_vis); if let PathResult::Failed { .. } | PathResult::NonModule(..) = path_res { @@ -1013,8 +1013,8 @@ impl<'a, 'b> ImportResolver<'a, 'b> { self.r.per_ns(|this, ns| { if !type_ns_only || ns == TypeNS { let orig_vis = import.vis.replace(ty::Visibility::Invisible); - let orig_blacklisted_binding = - mem::replace(&mut this.blacklisted_binding, target_bindings[ns].get()); + let orig_unusable_binding = + mem::replace(&mut this.unusable_binding, target_bindings[ns].get()); let orig_last_import_segment = mem::replace(&mut this.last_import_segment, true); let binding = this.resolve_ident_in_module( module, @@ -1025,7 +1025,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> { import.span, ); this.last_import_segment = orig_last_import_segment; - this.blacklisted_binding = orig_blacklisted_binding; + this.unusable_binding = orig_unusable_binding; import.vis.set(orig_vis); match binding { @@ -1291,8 +1291,8 @@ impl<'a, 'b> ImportResolver<'a, 'b> { return; } - let orig_blacklisted_binding = - mem::replace(&mut this.blacklisted_binding, target_bindings[ns].get()); + let orig_unusable_binding = + mem::replace(&mut this.unusable_binding, target_bindings[ns].get()); match this.early_resolve_ident_in_lexical_scope( target, @@ -1311,7 +1311,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> { Err(_) => is_redundant[ns] = Some(false), } - this.blacklisted_binding = orig_blacklisted_binding; + this.unusable_binding = orig_unusable_binding; } }); diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index 4451791780ead..679f5637686ff 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -842,14 +842,14 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> { report_error(self, ns); } Some(LexicalScopeBinding::Item(binding)) => { - let orig_blacklisted_binding = - replace(&mut self.r.blacklisted_binding, Some(binding)); + let orig_unusable_binding = + replace(&mut self.r.unusable_binding, Some(binding)); if let Some(LexicalScopeBinding::Res(..)) = self .resolve_ident_in_lexical_scope(ident, ns, None, use_tree.prefix.span) { report_error(self, ns); } - self.r.blacklisted_binding = orig_blacklisted_binding; + self.r.unusable_binding = orig_unusable_binding; } None => {} } diff --git a/src/librustc_resolve/late/lifetimes.rs b/src/librustc_resolve/late/lifetimes.rs index 903eee672cf1f..22db7e197faba 100644 --- a/src/librustc_resolve/late/lifetimes.rs +++ b/src/librustc_resolve/late/lifetimes.rs @@ -2122,7 +2122,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { self.impl_self { match path.res { - // Whitelist the types that unambiguously always + // Permit the types that unambiguously always // result in the same type constructor being used // (it can't differ between `Self` and `self`). Res::Def(DefKind::Struct | DefKind::Union | DefKind::Enum, _) diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index f3a1934abc9fe..edc37bac5dc67 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -867,7 +867,7 @@ pub struct Resolver<'a> { last_import_segment: bool, /// This binding should be ignored during in-module resolution, so that we don't get /// "self-confirming" import resolutions during import validation. - blacklisted_binding: Option<&'a NameBinding<'a>>, + unusable_binding: Option<&'a NameBinding<'a>>, /// The idents for the primitive types. primitive_type_table: PrimitiveTypeTable, @@ -1266,7 +1266,7 @@ impl<'a> Resolver<'a> { indeterminate_imports: Vec::new(), last_import_segment: false, - blacklisted_binding: None, + unusable_binding: None, primitive_type_table: PrimitiveTypeTable::new(), diff --git a/src/librustc_session/lint/builtin.rs b/src/librustc_session/lint/builtin.rs index 5deee6eb48e6a..aa2a133952f8f 100644 --- a/src/librustc_session/lint/builtin.rs +++ b/src/librustc_session/lint/builtin.rs @@ -404,7 +404,7 @@ declare_lint! { } declare_lint! { - pub INVALID_CODEBLOCK_ATTRIBUTE, + pub INVALID_CODEBLOCK_ATTRIBUTES, Warn, "codeblock attribute looks a lot like a known one" } @@ -602,7 +602,7 @@ declare_lint_pass! { UNSTABLE_NAME_COLLISIONS, IRREFUTABLE_LET_PATTERNS, INTRA_DOC_LINK_RESOLUTION_FAILURE, - INVALID_CODEBLOCK_ATTRIBUTE, + INVALID_CODEBLOCK_ATTRIBUTES, MISSING_CRATE_LEVEL_DOCS, MISSING_DOC_CODE_EXAMPLES, PRIVATE_DOC_TESTS, diff --git a/src/librustc_target/spec/aarch64_apple_ios.rs b/src/librustc_target/spec/aarch64_apple_ios.rs index 1447716ca8484..21dcec8d5e384 100644 --- a/src/librustc_target/spec/aarch64_apple_ios.rs +++ b/src/librustc_target/spec/aarch64_apple_ios.rs @@ -18,7 +18,7 @@ pub fn target() -> TargetResult { features: "+neon,+fp-armv8,+apple-a7".to_string(), eliminate_frame_pointer: false, max_atomic_width: Some(128), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), forces_embed_bitcode: true, // Taken from a clang build on Xcode 11.4.1. // These arguments are not actually invoked - they just have diff --git a/src/librustc_target/spec/aarch64_apple_tvos.rs b/src/librustc_target/spec/aarch64_apple_tvos.rs index 21f660ac8b839..2b0cd6cabf80f 100644 --- a/src/librustc_target/spec/aarch64_apple_tvos.rs +++ b/src/librustc_target/spec/aarch64_apple_tvos.rs @@ -18,7 +18,7 @@ pub fn target() -> TargetResult { features: "+neon,+fp-armv8,+apple-a7".to_string(), eliminate_frame_pointer: false, max_atomic_width: Some(128), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), forces_embed_bitcode: true, ..base }, diff --git a/src/librustc_target/spec/aarch64_fuchsia.rs b/src/librustc_target/spec/aarch64_fuchsia.rs index c0d5d575b6eb5..aabfe458ca3b6 100644 --- a/src/librustc_target/spec/aarch64_fuchsia.rs +++ b/src/librustc_target/spec/aarch64_fuchsia.rs @@ -15,6 +15,6 @@ pub fn target() -> TargetResult { target_env: String::new(), target_vendor: String::new(), linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), - options: TargetOptions { abi_blacklist: super::arm_base::abi_blacklist(), ..base }, + options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, }) } diff --git a/src/librustc_target/spec/aarch64_linux_android.rs b/src/librustc_target/spec/aarch64_linux_android.rs index 03fd059d60278..e4ecc7ac2dc80 100644 --- a/src/librustc_target/spec/aarch64_linux_android.rs +++ b/src/librustc_target/spec/aarch64_linux_android.rs @@ -20,6 +20,6 @@ pub fn target() -> TargetResult { target_env: String::new(), target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, - options: TargetOptions { abi_blacklist: super::arm_base::abi_blacklist(), ..base }, + options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, }) } diff --git a/src/librustc_target/spec/aarch64_unknown_cloudabi.rs b/src/librustc_target/spec/aarch64_unknown_cloudabi.rs index 7141954306769..1278b89c7fde2 100644 --- a/src/librustc_target/spec/aarch64_unknown_cloudabi.rs +++ b/src/librustc_target/spec/aarch64_unknown_cloudabi.rs @@ -3,7 +3,7 @@ use crate::spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { let mut base = super::cloudabi_base::opts(); base.max_atomic_width = Some(128); - base.abi_blacklist = super::arm_base::abi_blacklist(); + base.unsupported_abis = super::arm_base::unsupported_abis(); base.linker = Some("aarch64-unknown-cloudabi-cc".to_string()); Ok(Target { diff --git a/src/librustc_target/spec/aarch64_unknown_freebsd.rs b/src/librustc_target/spec/aarch64_unknown_freebsd.rs index 2177b7a0add32..5ae592c5139c8 100644 --- a/src/librustc_target/spec/aarch64_unknown_freebsd.rs +++ b/src/librustc_target/spec/aarch64_unknown_freebsd.rs @@ -15,6 +15,6 @@ pub fn target() -> TargetResult { target_env: String::new(), target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, - options: TargetOptions { abi_blacklist: super::arm_base::abi_blacklist(), ..base }, + options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, }) } diff --git a/src/librustc_target/spec/aarch64_unknown_hermit.rs b/src/librustc_target/spec/aarch64_unknown_hermit.rs index 7b020605102b1..5f978c03248b2 100644 --- a/src/librustc_target/spec/aarch64_unknown_hermit.rs +++ b/src/librustc_target/spec/aarch64_unknown_hermit.rs @@ -3,7 +3,7 @@ use crate::spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { let mut base = super::hermit_base::opts(); base.max_atomic_width = Some(128); - base.abi_blacklist = super::arm_base::abi_blacklist(); + base.unsupported_abis = super::arm_base::unsupported_abis(); base.linker = Some("aarch64-hermit-gcc".to_string()); Ok(Target { diff --git a/src/librustc_target/spec/aarch64_unknown_linux_gnu.rs b/src/librustc_target/spec/aarch64_unknown_linux_gnu.rs index 81f5fc8501584..036162248c76e 100644 --- a/src/librustc_target/spec/aarch64_unknown_linux_gnu.rs +++ b/src/librustc_target/spec/aarch64_unknown_linux_gnu.rs @@ -16,7 +16,7 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), target_mcount: "\u{1}_mcount".to_string(), ..base }, diff --git a/src/librustc_target/spec/aarch64_unknown_linux_musl.rs b/src/librustc_target/spec/aarch64_unknown_linux_musl.rs index 608b9d29b329f..dc613f35d1d31 100644 --- a/src/librustc_target/spec/aarch64_unknown_linux_musl.rs +++ b/src/librustc_target/spec/aarch64_unknown_linux_musl.rs @@ -16,7 +16,7 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), target_mcount: "\u{1}_mcount".to_string(), ..base }, diff --git a/src/librustc_target/spec/aarch64_unknown_netbsd.rs b/src/librustc_target/spec/aarch64_unknown_netbsd.rs index b06a2a906697c..8c2f6fcff7304 100644 --- a/src/librustc_target/spec/aarch64_unknown_netbsd.rs +++ b/src/librustc_target/spec/aarch64_unknown_netbsd.rs @@ -3,7 +3,7 @@ use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { let mut base = super::netbsd_base::opts(); base.max_atomic_width = Some(128); - base.abi_blacklist = super::arm_base::abi_blacklist(); + base.unsupported_abis = super::arm_base::unsupported_abis(); Ok(Target { llvm_target: "aarch64-unknown-netbsd".to_string(), diff --git a/src/librustc_target/spec/aarch64_unknown_none.rs b/src/librustc_target/spec/aarch64_unknown_none.rs index 7177c4e251e77..e012dce73fecb 100644 --- a/src/librustc_target/spec/aarch64_unknown_none.rs +++ b/src/librustc_target/spec/aarch64_unknown_none.rs @@ -18,7 +18,7 @@ pub fn target() -> Result { linker_is_gnu: true, max_atomic_width: Some(128), panic_strategy: PanicStrategy::Abort, - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), ..Default::default() }; Ok(Target { diff --git a/src/librustc_target/spec/aarch64_unknown_none_softfloat.rs b/src/librustc_target/spec/aarch64_unknown_none_softfloat.rs index 986300c677dfc..e2aa6e3b8f52c 100644 --- a/src/librustc_target/spec/aarch64_unknown_none_softfloat.rs +++ b/src/librustc_target/spec/aarch64_unknown_none_softfloat.rs @@ -18,7 +18,7 @@ pub fn target() -> Result { linker_is_gnu: true, max_atomic_width: Some(128), panic_strategy: PanicStrategy::Abort, - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), ..Default::default() }; Ok(Target { diff --git a/src/librustc_target/spec/aarch64_unknown_openbsd.rs b/src/librustc_target/spec/aarch64_unknown_openbsd.rs index c9cd64c3a84af..fd726c70f496b 100644 --- a/src/librustc_target/spec/aarch64_unknown_openbsd.rs +++ b/src/librustc_target/spec/aarch64_unknown_openbsd.rs @@ -3,7 +3,7 @@ use crate::spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { let mut base = super::openbsd_base::opts(); base.max_atomic_width = Some(128); - base.abi_blacklist = super::arm_base::abi_blacklist(); + base.unsupported_abis = super::arm_base::unsupported_abis(); Ok(Target { llvm_target: "aarch64-unknown-openbsd".to_string(), diff --git a/src/librustc_target/spec/aarch64_wrs_vxworks.rs b/src/librustc_target/spec/aarch64_wrs_vxworks.rs index 47b003b71144c..05f5d7d3a8b47 100644 --- a/src/librustc_target/spec/aarch64_wrs_vxworks.rs +++ b/src/librustc_target/spec/aarch64_wrs_vxworks.rs @@ -15,6 +15,6 @@ pub fn target() -> TargetResult { target_env: "gnu".to_string(), target_vendor: "wrs".to_string(), linker_flavor: LinkerFlavor::Gcc, - options: TargetOptions { abi_blacklist: super::arm_base::abi_blacklist(), ..base }, + options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, }) } diff --git a/src/librustc_target/spec/arm_base.rs b/src/librustc_target/spec/arm_base.rs index 77e7bfac62d58..b74d80dc6bb2b 100644 --- a/src/librustc_target/spec/arm_base.rs +++ b/src/librustc_target/spec/arm_base.rs @@ -1,6 +1,6 @@ use crate::spec::abi::Abi; // All the calling conventions trigger an assertion(Unsupported calling convention) in llvm on arm -pub fn abi_blacklist() -> Vec { +pub fn unsupported_abis() -> Vec { vec![Abi::Stdcall, Abi::Fastcall, Abi::Vectorcall, Abi::Thiscall, Abi::Win64, Abi::SysV64] } diff --git a/src/librustc_target/spec/arm_linux_androideabi.rs b/src/librustc_target/spec/arm_linux_androideabi.rs index 5dc6eaca9194e..7109d043f519c 100644 --- a/src/librustc_target/spec/arm_linux_androideabi.rs +++ b/src/librustc_target/spec/arm_linux_androideabi.rs @@ -17,6 +17,6 @@ pub fn target() -> TargetResult { target_env: String::new(), target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, - options: TargetOptions { abi_blacklist: super::arm_base::abi_blacklist(), ..base }, + options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, }) } diff --git a/src/librustc_target/spec/arm_unknown_linux_gnueabi.rs b/src/librustc_target/spec/arm_unknown_linux_gnueabi.rs index ead483df155a9..2e3bad83e2559 100644 --- a/src/librustc_target/spec/arm_unknown_linux_gnueabi.rs +++ b/src/librustc_target/spec/arm_unknown_linux_gnueabi.rs @@ -17,7 +17,7 @@ pub fn target() -> TargetResult { options: TargetOptions { features: "+strict-align,+v6".to_string(), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), target_mcount: "\u{1}__gnu_mcount_nc".to_string(), ..base }, diff --git a/src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs b/src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs index 53d2e9a46d080..f8e357cce6636 100644 --- a/src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs +++ b/src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs @@ -17,7 +17,7 @@ pub fn target() -> TargetResult { options: TargetOptions { features: "+strict-align,+v6,+vfp2,-d32".to_string(), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), target_mcount: "\u{1}__gnu_mcount_nc".to_string(), ..base }, diff --git a/src/librustc_target/spec/arm_unknown_linux_musleabi.rs b/src/librustc_target/spec/arm_unknown_linux_musleabi.rs index 03d191990c397..75753af9f3078 100644 --- a/src/librustc_target/spec/arm_unknown_linux_musleabi.rs +++ b/src/librustc_target/spec/arm_unknown_linux_musleabi.rs @@ -22,7 +22,7 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), target_mcount: "\u{1}mcount".to_string(), ..base }, diff --git a/src/librustc_target/spec/arm_unknown_linux_musleabihf.rs b/src/librustc_target/spec/arm_unknown_linux_musleabihf.rs index bd92f0f434711..c74c88e36125f 100644 --- a/src/librustc_target/spec/arm_unknown_linux_musleabihf.rs +++ b/src/librustc_target/spec/arm_unknown_linux_musleabihf.rs @@ -22,7 +22,7 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), target_mcount: "\u{1}mcount".to_string(), ..base }, diff --git a/src/librustc_target/spec/armebv7r_none_eabi.rs b/src/librustc_target/spec/armebv7r_none_eabi.rs index a1f68f6706a2a..e0d1f2653ce0b 100644 --- a/src/librustc_target/spec/armebv7r_none_eabi.rs +++ b/src/librustc_target/spec/armebv7r_none_eabi.rs @@ -22,7 +22,7 @@ pub fn target() -> TargetResult { relocation_model: RelocModel::Static, panic_strategy: PanicStrategy::Abort, max_atomic_width: Some(32), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), emit_debug_gdb_scripts: false, ..Default::default() }, diff --git a/src/librustc_target/spec/armebv7r_none_eabihf.rs b/src/librustc_target/spec/armebv7r_none_eabihf.rs index 4d81c21f52a7b..e2d37d45bf147 100644 --- a/src/librustc_target/spec/armebv7r_none_eabihf.rs +++ b/src/librustc_target/spec/armebv7r_none_eabihf.rs @@ -23,7 +23,7 @@ pub fn target() -> TargetResult { panic_strategy: PanicStrategy::Abort, features: "+vfp3,-d32,-fp16".to_string(), max_atomic_width: Some(32), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), emit_debug_gdb_scripts: false, ..Default::default() }, diff --git a/src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs b/src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs index 60f822a02947d..2580e8b0f8515 100644 --- a/src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs +++ b/src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs @@ -18,7 +18,7 @@ pub fn target() -> TargetResult { features: "+soft-float,+strict-align".to_string(), // Atomic operations provided by compiler-builtins max_atomic_width: Some(32), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), target_mcount: "\u{1}__gnu_mcount_nc".to_string(), ..base }, diff --git a/src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs b/src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs index 9fa0f609c7481..f28421dc77593 100644 --- a/src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs +++ b/src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs @@ -18,7 +18,7 @@ pub fn target() -> TargetResult { features: "+soft-float,+strict-align".to_string(), // Atomic operations provided by compiler-builtins max_atomic_width: Some(32), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), target_mcount: "\u{1}__gnu_mcount_nc".to_string(), ..base }, diff --git a/src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs b/src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs index bb19eb455cd3b..fe1fa88883d3e 100644 --- a/src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs +++ b/src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs @@ -21,7 +21,7 @@ pub fn target() -> TargetResult { features: "+soft-float,+strict-align".to_string(), // Atomic operations provided by compiler-builtins max_atomic_width: Some(32), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), target_mcount: "\u{1}mcount".to_string(), ..base }, diff --git a/src/librustc_target/spec/armv6_unknown_freebsd.rs b/src/librustc_target/spec/armv6_unknown_freebsd.rs index bbab1c60b1358..1e06f837997a1 100644 --- a/src/librustc_target/spec/armv6_unknown_freebsd.rs +++ b/src/librustc_target/spec/armv6_unknown_freebsd.rs @@ -17,7 +17,7 @@ pub fn target() -> TargetResult { options: TargetOptions { features: "+v6,+vfp2,-d32".to_string(), max_atomic_width: Some(64), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), target_mcount: "\u{1}__gnu_mcount_nc".to_string(), ..base }, diff --git a/src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs b/src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs index 4332d1498e7fa..ef40085888c81 100644 --- a/src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs +++ b/src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs @@ -17,7 +17,7 @@ pub fn target() -> TargetResult { options: TargetOptions { features: "+v6,+vfp2,-d32".to_string(), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), target_mcount: "__mcount".to_string(), ..base }, diff --git a/src/librustc_target/spec/armv7_apple_ios.rs b/src/librustc_target/spec/armv7_apple_ios.rs index c0c2ae909f8f0..393843526a8cc 100644 --- a/src/librustc_target/spec/armv7_apple_ios.rs +++ b/src/librustc_target/spec/armv7_apple_ios.rs @@ -17,7 +17,7 @@ pub fn target() -> TargetResult { options: TargetOptions { features: "+v7,+vfp3,+neon".to_string(), max_atomic_width: Some(64), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), ..base }, }) diff --git a/src/librustc_target/spec/armv7_linux_androideabi.rs b/src/librustc_target/spec/armv7_linux_androideabi.rs index 38d854163ecb6..38c6c31bd10da 100644 --- a/src/librustc_target/spec/armv7_linux_androideabi.rs +++ b/src/librustc_target/spec/armv7_linux_androideabi.rs @@ -25,6 +25,6 @@ pub fn target() -> TargetResult { target_env: String::new(), target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, - options: TargetOptions { abi_blacklist: super::arm_base::abi_blacklist(), ..base }, + options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, }) } diff --git a/src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs b/src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs index 7d34f5c63bfa1..e3f4fe0b2efb6 100644 --- a/src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs +++ b/src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs @@ -5,7 +5,7 @@ pub fn target() -> TargetResult { base.cpu = "cortex-a8".to_string(); base.max_atomic_width = Some(64); base.features = "+v7,+vfp3,+neon".to_string(); - base.abi_blacklist = super::arm_base::abi_blacklist(); + base.unsupported_abis = super::arm_base::unsupported_abis(); base.linker = Some("armv7-unknown-cloudabi-eabihf-cc".to_string()); Ok(Target { diff --git a/src/librustc_target/spec/armv7_unknown_freebsd.rs b/src/librustc_target/spec/armv7_unknown_freebsd.rs index e747ddca58a85..80a9e6d7e3c80 100644 --- a/src/librustc_target/spec/armv7_unknown_freebsd.rs +++ b/src/librustc_target/spec/armv7_unknown_freebsd.rs @@ -17,7 +17,7 @@ pub fn target() -> TargetResult { options: TargetOptions { features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(), max_atomic_width: Some(64), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), target_mcount: "\u{1}__gnu_mcount_nc".to_string(), ..base }, diff --git a/src/librustc_target/spec/armv7_unknown_linux_gnueabi.rs b/src/librustc_target/spec/armv7_unknown_linux_gnueabi.rs index c887bdf2a102b..0f175e9aef5e8 100644 --- a/src/librustc_target/spec/armv7_unknown_linux_gnueabi.rs +++ b/src/librustc_target/spec/armv7_unknown_linux_gnueabi.rs @@ -21,7 +21,7 @@ pub fn target() -> TargetResult { features: "+v7,+thumb2,+soft-float,-neon".to_string(), cpu: "generic".to_string(), max_atomic_width: Some(64), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), target_mcount: "\u{1}__gnu_mcount_nc".to_string(), ..base }, diff --git a/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs b/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs index 4ebc3416156b6..27923457cd16e 100644 --- a/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs +++ b/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs @@ -22,7 +22,7 @@ pub fn target() -> TargetResult { features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(), cpu: "generic".to_string(), max_atomic_width: Some(64), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), target_mcount: "\u{1}__gnu_mcount_nc".to_string(), ..base }, diff --git a/src/librustc_target/spec/armv7_unknown_linux_musleabi.rs b/src/librustc_target/spec/armv7_unknown_linux_musleabi.rs index bee3e2604adf2..3d1bf05237fd9 100644 --- a/src/librustc_target/spec/armv7_unknown_linux_musleabi.rs +++ b/src/librustc_target/spec/armv7_unknown_linux_musleabi.rs @@ -26,7 +26,7 @@ pub fn target() -> TargetResult { features: "+v7,+thumb2,+soft-float,-neon".to_string(), cpu: "generic".to_string(), max_atomic_width: Some(64), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), target_mcount: "\u{1}mcount".to_string(), ..base }, diff --git a/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs b/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs index c3cfeca7f27b7..03d7d88b0d6d0 100644 --- a/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs +++ b/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs @@ -25,7 +25,7 @@ pub fn target() -> TargetResult { features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(), cpu: "generic".to_string(), max_atomic_width: Some(64), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), target_mcount: "\u{1}mcount".to_string(), ..base }, diff --git a/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs b/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs index 9d382fe04be2d..18fc9ed2ec638 100644 --- a/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs +++ b/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs @@ -18,7 +18,7 @@ pub fn target() -> TargetResult { features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(), cpu: "generic".to_string(), max_atomic_width: Some(64), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), target_mcount: "__mcount".to_string(), ..base }, diff --git a/src/librustc_target/spec/armv7_wrs_vxworks_eabihf.rs b/src/librustc_target/spec/armv7_wrs_vxworks_eabihf.rs index 34eb04ea83e11..04d8702471af5 100644 --- a/src/librustc_target/spec/armv7_wrs_vxworks_eabihf.rs +++ b/src/librustc_target/spec/armv7_wrs_vxworks_eabihf.rs @@ -18,7 +18,7 @@ pub fn target() -> TargetResult { features: "+v7,+vfp3,-d32,+thumb2,-neon".to_string(), cpu: "generic".to_string(), max_atomic_width: Some(64), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), ..base }, }) diff --git a/src/librustc_target/spec/armv7a_none_eabi.rs b/src/librustc_target/spec/armv7a_none_eabi.rs index 09f1494e81cdb..1db279defff39 100644 --- a/src/librustc_target/spec/armv7a_none_eabi.rs +++ b/src/librustc_target/spec/armv7a_none_eabi.rs @@ -28,7 +28,7 @@ pub fn target() -> Result { disable_redzone: true, max_atomic_width: Some(64), panic_strategy: PanicStrategy::Abort, - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), emit_debug_gdb_scripts: false, ..Default::default() }; diff --git a/src/librustc_target/spec/armv7a_none_eabihf.rs b/src/librustc_target/spec/armv7a_none_eabihf.rs index 653ca76435bc5..22c2b306b43bb 100644 --- a/src/librustc_target/spec/armv7a_none_eabihf.rs +++ b/src/librustc_target/spec/armv7a_none_eabihf.rs @@ -16,7 +16,7 @@ pub fn target() -> Result { disable_redzone: true, max_atomic_width: Some(64), panic_strategy: PanicStrategy::Abort, - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), emit_debug_gdb_scripts: false, ..Default::default() }; diff --git a/src/librustc_target/spec/armv7r_none_eabi.rs b/src/librustc_target/spec/armv7r_none_eabi.rs index 29dfa17039736..fed83997190a7 100644 --- a/src/librustc_target/spec/armv7r_none_eabi.rs +++ b/src/librustc_target/spec/armv7r_none_eabi.rs @@ -22,7 +22,7 @@ pub fn target() -> TargetResult { relocation_model: RelocModel::Static, panic_strategy: PanicStrategy::Abort, max_atomic_width: Some(32), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), emit_debug_gdb_scripts: false, ..Default::default() }, diff --git a/src/librustc_target/spec/armv7r_none_eabihf.rs b/src/librustc_target/spec/armv7r_none_eabihf.rs index e6b0187c3313a..769ac13e51506 100644 --- a/src/librustc_target/spec/armv7r_none_eabihf.rs +++ b/src/librustc_target/spec/armv7r_none_eabihf.rs @@ -23,7 +23,7 @@ pub fn target() -> TargetResult { panic_strategy: PanicStrategy::Abort, features: "+vfp3,-d32,-fp16".to_string(), max_atomic_width: Some(32), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), emit_debug_gdb_scripts: false, ..Default::default() }, diff --git a/src/librustc_target/spec/armv7s_apple_ios.rs b/src/librustc_target/spec/armv7s_apple_ios.rs index 6a5654f10d416..998a7b2e16489 100644 --- a/src/librustc_target/spec/armv7s_apple_ios.rs +++ b/src/librustc_target/spec/armv7s_apple_ios.rs @@ -17,7 +17,7 @@ pub fn target() -> TargetResult { options: TargetOptions { features: "+v7,+vfp4,+neon".to_string(), max_atomic_width: Some(64), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), ..base }, }) diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index 29250f21383be..4a2dd8913185f 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -902,9 +902,10 @@ pub struct TargetOptions { /// Panic strategy: "unwind" or "abort" pub panic_strategy: PanicStrategy, - /// A blacklist of ABIs unsupported by the current target. Note that generic - /// ABIs are considered to be supported on all platforms and cannot be blacklisted. - pub abi_blacklist: Vec, + /// A list of ABIs unsupported by the current target. Note that generic ABIs + /// are considered to be supported on all platforms and cannot be marked + /// unsupported. + pub unsupported_abis: Vec, /// Whether or not linking dylibs to a static CRT is allowed. pub crt_static_allows_dylibs: bool, @@ -1056,7 +1057,7 @@ impl Default for TargetOptions { max_atomic_width: None, atomic_cas: true, panic_strategy: PanicStrategy::Unwind, - abi_blacklist: vec![], + unsupported_abis: vec![], crt_static_allows_dylibs: false, crt_static_default: false, crt_static_respected: false, @@ -1125,7 +1126,7 @@ impl Target { } pub fn is_abi_supported(&self, abi: Abi) -> bool { - abi.generic() || !self.options.abi_blacklist.contains(&abi) + abi.generic() || !self.options.unsupported_abis.contains(&abi) } /// Loads a target descriptor from a JSON object. @@ -1474,22 +1475,29 @@ impl Target { key!(llvm_args, list); key!(use_ctors_section, bool); - if let Some(array) = obj.find("abi-blacklist").and_then(Json::as_array) { - for name in array.iter().filter_map(|abi| abi.as_string()) { - match lookup_abi(name) { - Some(abi) => { - if abi.generic() { + // NB: The old name is deprecated, but support for it is retained for + // compatibility. + for name in ["abi-blacklist", "unsupported-abis"].iter() { + if let Some(array) = obj.find(name).and_then(Json::as_array) { + for name in array.iter().filter_map(|abi| abi.as_string()) { + match lookup_abi(name) { + Some(abi) => { + if abi.generic() { + return Err(format!( + "The ABI \"{}\" is considered to be supported on all \ + targets and cannot be marked unsupported", + abi + )); + } + + base.options.unsupported_abis.push(abi) + } + None => { return Err(format!( - "The ABI \"{}\" is considered to be supported on \ - all targets and cannot be blacklisted", - abi + "Unknown ABI \"{}\" in target specification", + name )); } - - base.options.abi_blacklist.push(abi) - } - None => { - return Err(format!("Unknown ABI \"{}\" in target specification", name)); } } } @@ -1705,11 +1713,11 @@ impl ToJson for Target { target_option_val!(llvm_args); target_option_val!(use_ctors_section); - if default.abi_blacklist != self.options.abi_blacklist { + if default.unsupported_abis != self.options.unsupported_abis { d.insert( - "abi-blacklist".to_string(), + "unsupported-abis".to_string(), self.options - .abi_blacklist + .unsupported_abis .iter() .map(|&name| Abi::name(name).to_json()) .collect::>() diff --git a/src/librustc_target/spec/nvptx64_nvidia_cuda.rs b/src/librustc_target/spec/nvptx64_nvidia_cuda.rs index e0a402533e777..0c8f2a34301ee 100644 --- a/src/librustc_target/spec/nvptx64_nvidia_cuda.rs +++ b/src/librustc_target/spec/nvptx64_nvidia_cuda.rs @@ -55,7 +55,7 @@ pub fn target() -> TargetResult { // FIXME: enable compilation tests for the target and // create the tests for this. - abi_blacklist: vec![ + unsupported_abis: vec![ Abi::Cdecl, Abi::Stdcall, Abi::Fastcall, diff --git a/src/librustc_target/spec/riscv32i_unknown_none_elf.rs b/src/librustc_target/spec/riscv32i_unknown_none_elf.rs index d7b3e7e15307a..977aa896f2520 100644 --- a/src/librustc_target/spec/riscv32i_unknown_none_elf.rs +++ b/src/librustc_target/spec/riscv32i_unknown_none_elf.rs @@ -24,7 +24,7 @@ pub fn target() -> TargetResult { panic_strategy: PanicStrategy::Abort, relocation_model: RelocModel::Static, emit_debug_gdb_scripts: false, - abi_blacklist: super::riscv_base::abi_blacklist(), + unsupported_abis: super::riscv_base::unsupported_abis(), ..Default::default() }, }) diff --git a/src/librustc_target/spec/riscv32imac_unknown_none_elf.rs b/src/librustc_target/spec/riscv32imac_unknown_none_elf.rs index b93b6fcf8002a..1a85cdff1315c 100644 --- a/src/librustc_target/spec/riscv32imac_unknown_none_elf.rs +++ b/src/librustc_target/spec/riscv32imac_unknown_none_elf.rs @@ -24,7 +24,7 @@ pub fn target() -> TargetResult { panic_strategy: PanicStrategy::Abort, relocation_model: RelocModel::Static, emit_debug_gdb_scripts: false, - abi_blacklist: super::riscv_base::abi_blacklist(), + unsupported_abis: super::riscv_base::unsupported_abis(), ..Default::default() }, }) diff --git a/src/librustc_target/spec/riscv32imc_unknown_none_elf.rs b/src/librustc_target/spec/riscv32imc_unknown_none_elf.rs index a16e7e31c6619..e3c1c6908a23a 100644 --- a/src/librustc_target/spec/riscv32imc_unknown_none_elf.rs +++ b/src/librustc_target/spec/riscv32imc_unknown_none_elf.rs @@ -24,7 +24,7 @@ pub fn target() -> TargetResult { panic_strategy: PanicStrategy::Abort, relocation_model: RelocModel::Static, emit_debug_gdb_scripts: false, - abi_blacklist: super::riscv_base::abi_blacklist(), + unsupported_abis: super::riscv_base::unsupported_abis(), ..Default::default() }, }) diff --git a/src/librustc_target/spec/riscv64gc_unknown_linux_gnu.rs b/src/librustc_target/spec/riscv64gc_unknown_linux_gnu.rs index 715449d74ce22..f7a93c916d1d5 100644 --- a/src/librustc_target/spec/riscv64gc_unknown_linux_gnu.rs +++ b/src/librustc_target/spec/riscv64gc_unknown_linux_gnu.rs @@ -13,7 +13,7 @@ pub fn target() -> TargetResult { target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { - abi_blacklist: super::riscv_base::abi_blacklist(), + unsupported_abis: super::riscv_base::unsupported_abis(), code_model: Some(CodeModel::Medium), cpu: "generic-rv64".to_string(), features: "+m,+a,+f,+d,+c".to_string(), diff --git a/src/librustc_target/spec/riscv64gc_unknown_none_elf.rs b/src/librustc_target/spec/riscv64gc_unknown_none_elf.rs index e5147a12ed320..857af4ceb0d9f 100644 --- a/src/librustc_target/spec/riscv64gc_unknown_none_elf.rs +++ b/src/librustc_target/spec/riscv64gc_unknown_none_elf.rs @@ -25,7 +25,7 @@ pub fn target() -> TargetResult { relocation_model: RelocModel::Static, code_model: Some(CodeModel::Medium), emit_debug_gdb_scripts: false, - abi_blacklist: super::riscv_base::abi_blacklist(), + unsupported_abis: super::riscv_base::unsupported_abis(), ..Default::default() }, }) diff --git a/src/librustc_target/spec/riscv64imac_unknown_none_elf.rs b/src/librustc_target/spec/riscv64imac_unknown_none_elf.rs index dc056b55b3868..36fe7730f95bf 100644 --- a/src/librustc_target/spec/riscv64imac_unknown_none_elf.rs +++ b/src/librustc_target/spec/riscv64imac_unknown_none_elf.rs @@ -25,7 +25,7 @@ pub fn target() -> TargetResult { relocation_model: RelocModel::Static, code_model: Some(CodeModel::Medium), emit_debug_gdb_scripts: false, - abi_blacklist: super::riscv_base::abi_blacklist(), + unsupported_abis: super::riscv_base::unsupported_abis(), ..Default::default() }, }) diff --git a/src/librustc_target/spec/riscv_base.rs b/src/librustc_target/spec/riscv_base.rs index ec1dc9b4918bd..64cf890037e51 100644 --- a/src/librustc_target/spec/riscv_base.rs +++ b/src/librustc_target/spec/riscv_base.rs @@ -2,7 +2,7 @@ use crate::spec::abi::Abi; // All the calling conventions trigger an assertion(Unsupported calling // convention) in llvm on RISCV -pub fn abi_blacklist() -> Vec { +pub fn unsupported_abis() -> Vec { vec![ Abi::Cdecl, Abi::Stdcall, diff --git a/src/librustc_target/spec/tests/tests_impl.rs b/src/librustc_target/spec/tests/tests_impl.rs index b2ad62e1b260b..b2c2b8254d8f0 100644 --- a/src/librustc_target/spec/tests/tests_impl.rs +++ b/src/librustc_target/spec/tests/tests_impl.rs @@ -16,8 +16,8 @@ pub(super) fn test_target(target: TargetResult) { impl Target { fn check_consistency(&self) { // Check that LLD with the given flavor is treated identically to the linker it emulates. - // If you target really needs to deviate from the rules below, whitelist it - // and document the reasons. + // If your target really needs to deviate from the rules below, except it and document the + // reasons. assert_eq!( self.linker_flavor == LinkerFlavor::Msvc || self.linker_flavor == LinkerFlavor::Lld(LldFlavor::Link), diff --git a/src/librustc_target/spec/thumb_base.rs b/src/librustc_target/spec/thumb_base.rs index 646a149a33621..2f7d15d5856f6 100644 --- a/src/librustc_target/spec/thumb_base.rs +++ b/src/librustc_target/spec/thumb_base.rs @@ -41,7 +41,7 @@ pub fn opts() -> TargetOptions { // Similarly, one almost always never wants to use relocatable code because of the extra // costs it involves. relocation_model: RelocModel::Static, - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), // When this section is added a volatile load to its start address is also generated. This // volatile load is a footgun as it can end up loading an invalid memory address, depending // on how the user set up their linker scripts. This section adds pretty printer for stuff diff --git a/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs b/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs index 21d62d252e09a..37828026fe113 100644 --- a/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs +++ b/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs @@ -37,7 +37,7 @@ pub fn target() -> TargetResult { features: "+vfp3,+neon".to_string(), cpu: "generic".to_string(), max_atomic_width: Some(64), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), ..base }, }) diff --git a/src/librustc_target/spec/thumbv7a_uwp_windows_msvc.rs b/src/librustc_target/spec/thumbv7a_uwp_windows_msvc.rs index ff2e892100607..29a4a9875e5b0 100644 --- a/src/librustc_target/spec/thumbv7a_uwp_windows_msvc.rs +++ b/src/librustc_target/spec/thumbv7a_uwp_windows_msvc.rs @@ -23,7 +23,7 @@ pub fn target() -> TargetResult { options: TargetOptions { features: "+vfp3,+neon".to_string(), cpu: "generic".to_string(), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), ..base }, }) diff --git a/src/librustc_target/spec/thumbv7neon_linux_androideabi.rs b/src/librustc_target/spec/thumbv7neon_linux_androideabi.rs index 02ad9ab7d9a8c..c52f077f6f16c 100644 --- a/src/librustc_target/spec/thumbv7neon_linux_androideabi.rs +++ b/src/librustc_target/spec/thumbv7neon_linux_androideabi.rs @@ -25,6 +25,6 @@ pub fn target() -> TargetResult { target_env: "".to_string(), target_vendor: "unknown".to_string(), linker_flavor: LinkerFlavor::Gcc, - options: TargetOptions { abi_blacklist: super::arm_base::abi_blacklist(), ..base }, + options: TargetOptions { unsupported_abis: super::arm_base::unsupported_abis(), ..base }, }) } diff --git a/src/librustc_target/spec/thumbv7neon_unknown_linux_gnueabihf.rs b/src/librustc_target/spec/thumbv7neon_unknown_linux_gnueabihf.rs index 04e051485a933..78936948e642e 100644 --- a/src/librustc_target/spec/thumbv7neon_unknown_linux_gnueabihf.rs +++ b/src/librustc_target/spec/thumbv7neon_unknown_linux_gnueabihf.rs @@ -25,7 +25,7 @@ pub fn target() -> TargetResult { features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(), cpu: "generic".to_string(), max_atomic_width: Some(64), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), ..base }, }) diff --git a/src/librustc_target/spec/thumbv7neon_unknown_linux_musleabihf.rs b/src/librustc_target/spec/thumbv7neon_unknown_linux_musleabihf.rs index 3d39a405a411c..f759c3eeb011c 100644 --- a/src/librustc_target/spec/thumbv7neon_unknown_linux_musleabihf.rs +++ b/src/librustc_target/spec/thumbv7neon_unknown_linux_musleabihf.rs @@ -29,7 +29,7 @@ pub fn target() -> TargetResult { features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(), cpu: "generic".to_string(), max_atomic_width: Some(64), - abi_blacklist: super::arm_base::abi_blacklist(), + unsupported_abis: super::arm_base::unsupported_abis(), target_mcount: "\u{1}mcount".to_string(), ..base }, diff --git a/src/librustc_target/spec/wasm32_base.rs b/src/librustc_target/spec/wasm32_base.rs index d4a65aa1a2574..8423573b52d51 100644 --- a/src/librustc_target/spec/wasm32_base.rs +++ b/src/librustc_target/spec/wasm32_base.rs @@ -40,14 +40,14 @@ pub fn options() -> TargetOptions { // corrupting static data. arg("--stack-first"); - // FIXME we probably shouldn't pass this but instead pass an explicit - // whitelist of symbols we'll allow to be undefined. We don't currently have - // a mechanism of knowing, however, which symbols are intended to be - // imported from the environment and which are intended to be imported from - // other objects linked elsewhere. This is a coarse approximation but is - // sure to hide some bugs and frustrate someone at some point, so we should - // ideally work towards a world where we can explicitly list symbols that - // are supposed to be imported and have all other symbols generate errors if + // FIXME we probably shouldn't pass this but instead pass an explicit list + // of symbols we'll allow to be undefined. We don't currently have a + // mechanism of knowing, however, which symbols are intended to be imported + // from the environment and which are intended to be imported from other + // objects linked elsewhere. This is a coarse approximation but is sure to + // hide some bugs and frustrate someone at some point, so we should ideally + // work towards a world where we can explicitly list symbols that are + // supposed to be imported and have all other symbols generate errors if // they remain undefined. arg("--allow-undefined"); diff --git a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs index cdfe5f9f92db0..d677d84b2ba13 100644 --- a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs +++ b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs @@ -2139,7 +2139,7 @@ pub trait NextTypeParamName { impl NextTypeParamName for &[hir::GenericParam<'_>] { fn next_type_param_name(&self, name: Option<&str>) -> String { - // This is the whitelist of possible parameter names that we might suggest. + // This is the list of possible parameter names that we might suggest. let name = name.and_then(|n| n.chars().next()).map(|c| c.to_string().to_uppercase()); let name = name.as_deref(); let possible_names = [name.unwrap_or("T"), "T", "U", "V", "X", "Y", "Z", "A", "B", "C"]; diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 85c073ca30034..9a9630f095886 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -236,7 +236,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .tcx .get_attrs(m.def_id) .iter() - // This special internal attribute is used to whitelist + // This special internal attribute is used to permit // "identity-like" conversion methods to be suggested here. // // FIXME (#46459 and #46460): ideally diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index 1eaa5a6c31e20..e6b51f4c2cd2a 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -913,7 +913,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if let ty::Adt(..) = rcvr_t.kind { // Try alternative arbitrary self types that could fulfill this call. // FIXME: probe for all types that *could* be arbitrary self-types, not - // just this whitelist. + // just this list. try_alt_rcvr(&mut err, self.tcx.mk_lang_item(rcvr_t, lang_items::OwnedBoxLangItem)); try_alt_rcvr(&mut err, self.tcx.mk_lang_item(rcvr_t, lang_items::PinTypeLangItem)); try_alt_rcvr(&mut err, self.tcx.mk_diagnostic_item(rcvr_t, sym::Arc)); @@ -1806,7 +1806,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // If this is an input value, we require its type to be fully resolved // at this point. This allows us to provide helpful coercions which help - // pass the type whitelist in a later pass. + // pass the type candidate list in a later pass. // // We don't require output types to be resolved at this point, which // allows them to be inferred based on how they are used later in the diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index cc491c527db0b..74066a3bbf5f0 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -2150,7 +2150,7 @@ fn from_target_feature( tcx: TyCtxt<'_>, id: DefId, attr: &ast::Attribute, - whitelist: &FxHashMap>, + supported_target_features: &FxHashMap>, target_features: &mut Vec, ) { let list = match attr.meta_item_list() { @@ -2184,8 +2184,7 @@ fn from_target_feature( // We allow comma separation to enable multiple features. target_features.extend(value.as_str().split(',').filter_map(|feature| { - // Only allow whitelisted features per platform. - let feature_gate = match whitelist.get(feature) { + let feature_gate = match supported_target_features.get(feature) { Some(g) => g, None => { let msg = @@ -2196,7 +2195,7 @@ fn from_target_feature( format!("`{}` is not valid for this target", feature), ); if feature.starts_with('+') { - let valid = whitelist.contains_key(&feature[1..]); + let valid = supported_target_features.contains_key(&feature[1..]); if valid { err.help("consider removing the leading `+` in the feature name"); } @@ -2246,9 +2245,9 @@ fn linkage_by_name(tcx: TyCtxt<'_>, def_id: DefId, name: &str) -> Linkage { // Use the names from src/llvm/docs/LangRef.rst here. Most types are only // applicable to variable declarations and may not really make sense for - // Rust code in the first place but whitelist them anyway and trust that - // the user knows what s/he's doing. Who knows, unanticipated use cases - // may pop up in the future. + // Rust code in the first place but allow them anyway and trust that the + // user knows what s/he's doing. Who knows, unanticipated use cases may pop + // up in the future. // // ghost, dllimport, dllexport and linkonce_odr_autohide are not supported // and don't have to be, LLVM treats them as no-ops. @@ -2283,7 +2282,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs { codegen_fn_attrs.flags |= CodegenFnAttrFlags::TRACK_CALLER; } - let whitelist = tcx.target_features_whitelist(LOCAL_CRATE); + let supported_target_features = tcx.supported_target_features(LOCAL_CRATE); let mut inline_span = None; let mut link_ordinal_span = None; @@ -2386,7 +2385,13 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs { check_target_feature_trait_unsafe(tcx, local_id, attr.span); } } - from_target_feature(tcx, id, attr, &whitelist, &mut codegen_fn_attrs.target_features); + from_target_feature( + tcx, + id, + attr, + &supported_target_features, + &mut codegen_fn_attrs.target_features, + ); } else if attr.check_name(sym::linkage) { if let Some(val) = attr.value_str() { codegen_fn_attrs.linkage = Some(linkage_by_name(tcx, id, &val.as_str())); diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 38f202e84accb..6dcb3b00070ca 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -214,7 +214,7 @@ pub fn new_handler( /// This function is used to setup the lint initialization. By default, in rustdoc, everything /// is "allowed". Depending if we run in test mode or not, we want some of them to be at their -/// default level. For example, the "INVALID_CODEBLOCK_ATTRIBUTE" lint is activated in both +/// default level. For example, the "INVALID_CODEBLOCK_ATTRIBUTES" lint is activated in both /// modes. /// /// A little detail easy to forget is that there is a way to set the lint level for all lints @@ -225,7 +225,7 @@ pub fn new_handler( /// * Vector of tuples of lints' name and their associated "max" level /// * HashMap of lint id with their associated "max" level pub fn init_lints( - mut whitelisted_lints: Vec, + mut allowed_lints: Vec, lint_opts: Vec<(String, lint::Level)>, filter_call: F, ) -> (Vec<(String, lint::Level)>, FxHashMap) @@ -234,8 +234,8 @@ where { let warnings_lint_name = lint::builtin::WARNINGS.name; - whitelisted_lints.push(warnings_lint_name.to_owned()); - whitelisted_lints.extend(lint_opts.iter().map(|(lint, _)| lint).cloned()); + allowed_lints.push(warnings_lint_name.to_owned()); + allowed_lints.extend(lint_opts.iter().map(|(lint, _)| lint).cloned()); let lints = || { lint::builtin::HardwiredLints::get_lints() @@ -245,7 +245,7 @@ where let lint_opts = lints() .filter_map(|lint| { - // Whitelist feature-gated lints to avoid feature errors when trying to + // Permit feature-gated lints to avoid feature errors when trying to // allow all lints. if lint.name == warnings_lint_name || lint.feature_gate.is_some() { None @@ -258,9 +258,9 @@ where let lint_caps = lints() .filter_map(|lint| { - // We don't want to whitelist *all* lints so let's - // ignore those ones. - if whitelisted_lints.iter().any(|l| lint.name == l) { + // We don't want to allow *all* lints so let's ignore + // those ones. + if allowed_lints.iter().any(|l| lint.name == l) { None } else { Some((lint::LintId::of(lint), lint::Allow)) @@ -315,11 +315,11 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt let missing_doc_example = rustc_lint::builtin::MISSING_DOC_CODE_EXAMPLES.name; let private_doc_tests = rustc_lint::builtin::PRIVATE_DOC_TESTS.name; let no_crate_level_docs = rustc_lint::builtin::MISSING_CRATE_LEVEL_DOCS.name; - let invalid_codeblock_attribute_name = rustc_lint::builtin::INVALID_CODEBLOCK_ATTRIBUTE.name; + let invalid_codeblock_attribute_name = rustc_lint::builtin::INVALID_CODEBLOCK_ATTRIBUTES.name; - // In addition to those specific lints, we also need to whitelist those given through + // In addition to those specific lints, we also need to allow those given through // command line, otherwise they'll get ignored and we don't want that. - let whitelisted_lints = vec![ + let allowed_lints = vec![ intra_link_resolution_failure_name.to_owned(), missing_docs.to_owned(), missing_doc_example.to_owned(), @@ -328,7 +328,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt invalid_codeblock_attribute_name.to_owned(), ]; - let (lint_opts, lint_caps) = init_lints(whitelisted_lints, lint_opts, |lint| { + let (lint_opts, lint_caps) = init_lints(allowed_lints, lint_opts, |lint| { if lint.name == intra_link_resolution_failure_name || lint.name == invalid_codeblock_attribute_name { diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 7a6626766d388..a0f8eb04e2efb 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -665,7 +665,7 @@ impl<'a, 'b> ExtraInfo<'a, 'b> { (None, None) => return, }; self.tcx.struct_span_lint_hir( - lint::builtin::INVALID_CODEBLOCK_ATTRIBUTE, + lint::builtin::INVALID_CODEBLOCK_ATTRIBUTES, hir_id, self.sp, |lint| { diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 69e3540ed625b..69f2bf2d1dbf5 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -3151,7 +3151,7 @@ fn item_enum(w: &mut Buffer, cx: &Context, it: &clean::Item, e: &clean::Enum) { render_assoc_items(w, cx, it, it.def_id, AssocItemRender::All) } -const ATTRIBUTE_WHITELIST: &[Symbol] = &[ +const ALLOWED_ATTRIBUTES: &[Symbol] = &[ sym::export_name, sym::lang, sym::link_section, @@ -3173,7 +3173,7 @@ fn render_attributes(w: &mut Buffer, it: &clean::Item, top: bool) { let mut attrs = String::new(); for attr in &it.attrs.other_attrs { - if !ATTRIBUTE_WHITELIST.contains(&attr.name_or_empty()) { + if !ALLOWED_ATTRIBUTES.contains(&attr.name_or_empty()) { continue; } diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index e9504aa3af123..c9958bc87fdfb 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -46,13 +46,13 @@ pub struct TestOptions { pub fn run(options: Options) -> Result<(), String> { let input = config::Input::File(options.input.clone()); - let invalid_codeblock_attribute_name = rustc_lint::builtin::INVALID_CODEBLOCK_ATTRIBUTE.name; + let invalid_codeblock_attribute_name = rustc_lint::builtin::INVALID_CODEBLOCK_ATTRIBUTES.name; - // In addition to those specific lints, we also need to whitelist those given through + // In addition to those specific lints, we also need to allow those given through // command line, otherwise they'll get ignored and we don't want that. - let whitelisted_lints = vec![invalid_codeblock_attribute_name.to_owned()]; + let allowed_lints = vec![invalid_codeblock_attribute_name.to_owned()]; - let (lint_opts, lint_caps) = init_lints(whitelisted_lints, options.lint_opts.clone(), |lint| { + let (lint_opts, lint_caps) = init_lints(allowed_lints, options.lint_opts.clone(), |lint| { if lint.name == invalid_codeblock_attribute_name { None } else { diff --git a/src/libstd/time.rs b/src/libstd/time.rs index 84fa35e01bb09..9f4fa89cd5506 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -241,7 +241,7 @@ impl Instant { // returned instead of what the OS says if the OS goes backwards. // // To hopefully mitigate the impact of this, a few platforms are - // whitelisted as "these at least haven't gone backwards yet". + // excluded as "these at least haven't gone backwards yet". if time::Instant::actually_monotonic() { return Instant(os_now); } diff --git a/src/llvm-project b/src/llvm-project index 6c040dd86ed62..d134a53927fa0 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 6c040dd86ed62d38e585279027486e6efc42fb36 +Subproject commit d134a53927fa033ae7e0f3e8ee872ff2dc71468d diff --git a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs index efc62361694a5..dd49ca67c6748 100644 --- a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs +++ b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs @@ -52,7 +52,7 @@ impl CodegenBackend for TheBackend { fn provide(&self, providers: &mut Providers) { rustc_symbol_mangling::provide(providers); - providers.target_features_whitelist = |tcx, _cnum| { + providers.supported_target_features = |tcx, _cnum| { Default::default() // Just a dummy }; providers.is_reachable_non_generic = |_tcx, _defid| true; diff --git a/src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py b/src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py index 927edff4c22a5..e92ef878ab9aa 100644 --- a/src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py +++ b/src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py @@ -5,7 +5,7 @@ from subprocess import PIPE, Popen -# This is a whitelist of files which are stable crates or simply are not crates, +# This is an list of files which are stable crates or simply are not crates, # we don't check for the instability of these crates as they're all stable! STABLE_CRATES = ['std', 'alloc', 'core', 'proc_macro', 'rsbegin.o', 'rsend.o', 'dllcrt2.o', 'crt2.o', 'clang_rt'] diff --git a/src/test/rustdoc-ui/check-attr-test.rs b/src/test/rustdoc-ui/check-attr-test.rs index c4140bbb70a78..665f330e34ea5 100644 --- a/src/test/rustdoc-ui/check-attr-test.rs +++ b/src/test/rustdoc-ui/check-attr-test.rs @@ -1,6 +1,6 @@ // compile-flags:--test -#![deny(invalid_codeblock_attribute)] +#![deny(invalid_codeblock_attributes)] /// foo /// diff --git a/src/test/rustdoc-ui/check-attr-test.stderr b/src/test/rustdoc-ui/check-attr-test.stderr index 45a2d6ec15e7d..1e067a5d21c44 100644 --- a/src/test/rustdoc-ui/check-attr-test.stderr +++ b/src/test/rustdoc-ui/check-attr-test.stderr @@ -11,8 +11,8 @@ error: unknown attribute `compile-fail`. Did you mean `compile_fail`? note: the lint level is defined here --> $DIR/check-attr-test.rs:3:9 | -3 | #![deny(invalid_codeblock_attribute)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 | #![deny(invalid_codeblock_attributes)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully error: unknown attribute `compilefail`. Did you mean `compile_fail`? diff --git a/src/test/rustdoc-ui/check-attr.rs b/src/test/rustdoc-ui/check-attr.rs index a93ec29131907..9e02eab753e26 100644 --- a/src/test/rustdoc-ui/check-attr.rs +++ b/src/test/rustdoc-ui/check-attr.rs @@ -1,4 +1,4 @@ -#![deny(invalid_codeblock_attribute)] +#![deny(invalid_codeblock_attributes)] /// foo //~^ ERROR diff --git a/src/test/rustdoc-ui/check-attr.stderr b/src/test/rustdoc-ui/check-attr.stderr index 5d6939bd09205..919eb047eefb5 100644 --- a/src/test/rustdoc-ui/check-attr.stderr +++ b/src/test/rustdoc-ui/check-attr.stderr @@ -13,8 +13,8 @@ LL | | /// ``` note: the lint level is defined here --> $DIR/check-attr.rs:1:9 | -LL | #![deny(invalid_codeblock_attribute)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![deny(invalid_codeblock_attributes)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully error: unknown attribute `compilefail`. Did you mean `compile_fail`? diff --git a/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs b/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs index 9ba2675477878..4e9d4d342734c 100644 --- a/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs +++ b/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs @@ -21,19 +21,19 @@ use rustc_span::source_map; #[plugin_registrar] pub fn plugin_registrar(reg: &mut Registry) { - reg.lint_store.register_lints(&[&MISSING_WHITELISTED_ATTR]); - reg.lint_store.register_late_pass(|| box MissingWhitelistedAttrPass); + reg.lint_store.register_lints(&[&MISSING_ALLOWED_ATTR]); + reg.lint_store.register_late_pass(|| box MissingAllowedAttrPass); } declare_lint! { - MISSING_WHITELISTED_ATTR, + MISSING_ALLOWED_ATTR, Deny, - "Checks for missing `whitelisted_attr` attribute" + "Checks for missing `allowed_attr` attribute" } -declare_lint_pass!(MissingWhitelistedAttrPass => [MISSING_WHITELISTED_ATTR]); +declare_lint_pass!(MissingAllowedAttrPass => [MISSING_ALLOWED_ATTR]); -impl<'tcx> LateLintPass<'tcx> for MissingWhitelistedAttrPass { +impl<'tcx> LateLintPass<'tcx> for MissingAllowedAttrPass { fn check_fn( &mut self, cx: &LateContext<'tcx>, @@ -48,10 +48,10 @@ impl<'tcx> LateLintPass<'tcx> for MissingWhitelistedAttrPass { _ => cx.tcx.hir().expect_item(cx.tcx.hir().get_parent_item(id)), }; - let whitelisted = |attr| pprust::attribute_to_string(attr).contains("whitelisted_attr"); - if !item.attrs.iter().any(whitelisted) { - cx.lint(MISSING_WHITELISTED_ATTR, |lint| { - lint.build("Missing 'whitelisted_attr' attribute").set_span(span).emit() + let allowed = |attr| pprust::attribute_to_string(attr).contains("allowed_attr"); + if !item.attrs.iter().any(allowed) { + cx.lint(MISSING_ALLOWED_ATTR, |lint| { + lint.build("Missing 'allowed_attr' attribute").set_span(span).emit() }); } } diff --git a/src/test/ui-fulldeps/issue-40001.rs b/src/test/ui-fulldeps/issue-40001.rs index c3f98197250d1..e14338fdbbf35 100644 --- a/src/test/ui-fulldeps/issue-40001.rs +++ b/src/test/ui-fulldeps/issue-40001.rs @@ -6,5 +6,5 @@ #![plugin(issue_40001_plugin)] //~ WARNING compiler plugins are deprecated #![register_tool(plugin)] -#[plugin::whitelisted_attr] +#[plugin::allowed_attr] fn main() {} diff --git a/src/test/ui/asm/type-check-3.rs b/src/test/ui/asm/type-check-3.rs index 5de15fe49067a..0f803eff17b8a 100644 --- a/src/test/ui/asm/type-check-3.rs +++ b/src/test/ui/asm/type-check-3.rs @@ -7,7 +7,7 @@ use std::arch::x86_64::{_mm256_setzero_ps, _mm_setzero_ps}; fn main() { unsafe { - // Types must be in the whitelist for the register class + // Types must be listed in the register class. asm!("{}", in(reg) 0i128); //~^ ERROR type `i128` cannot be used with this register class diff --git a/src/test/ui/consts/const-eval/ub-enum.rs b/src/test/ui/consts/const-eval/ub-enum.rs index c49997c6c33f6..136b33208c293 100644 --- a/src/test/ui/consts/const-eval/ub-enum.rs +++ b/src/test/ui/consts/const-eval/ub-enum.rs @@ -88,9 +88,10 @@ const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute //~^ ERROR is undefined behavior // All variants are uninhabited but also have data. -const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(1u64) }; +// Use `0` as constant to make behavior endianess-independent. +const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) }; //~^ ERROR is undefined behavior -const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(1u64) }; +const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) }; //~^ ERROR is undefined behavior fn main() { diff --git a/src/test/ui/consts/const-eval/ub-enum.stderr b/src/test/ui/consts/const-eval/ub-enum.stderr index 217bfb628a018..7b3ee535c8ec6 100644 --- a/src/test/ui/consts/const-eval/ub-enum.stderr +++ b/src/test/ui/consts/const-eval/ub-enum.stderr @@ -87,18 +87,18 @@ LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::tran = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:91:1 + --> $DIR/ub-enum.rs:92:1 | -LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(1u64) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of the never type `!` at ..0.1 +LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of uninhabited type Never at ..0.1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:93:1 + --> $DIR/ub-enum.rs:94:1 | -LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(1u64) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of uninhabited type Never at ..0.1 +LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of the never type `!` at ..0.1 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. diff --git a/src/test/ui/issues/issue-29540.rs b/src/test/ui/issues/issue-29540.rs index 2a4d50f613cdc..c0de20822bacf 100644 --- a/src/test/ui/issues/issue-29540.rs +++ b/src/test/ui/issues/issue-29540.rs @@ -283,7 +283,7 @@ pub struct Config { pub mds_beacon_interval: String, pub mds_beacon_grace: String, pub mds_enforce_unique_name: String, - pub mds_blacklist_interval: String, + pub mds_interval: String, pub mds_session_timeout: String, pub mds_freeze_tree_timeout: String, pub mds_session_autoclose: String, diff --git a/src/test/ui/issues/issue-74082.rs b/src/test/ui/issues/issue-74082.rs new file mode 100644 index 0000000000000..982f8ef02538b --- /dev/null +++ b/src/test/ui/issues/issue-74082.rs @@ -0,0 +1,9 @@ +#![allow(dead_code)] + +#[repr(i128)] //~ ERROR: attribute should be applied to enum +struct Foo; + +#[repr(u128)] //~ ERROR: attribute should be applied to enum +struct Bar; + +fn main() {} diff --git a/src/test/ui/issues/issue-74082.stderr b/src/test/ui/issues/issue-74082.stderr new file mode 100644 index 0000000000000..08fe415513d0d --- /dev/null +++ b/src/test/ui/issues/issue-74082.stderr @@ -0,0 +1,19 @@ +error[E0517]: attribute should be applied to enum + --> $DIR/issue-74082.rs:3:8 + | +LL | #[repr(i128)] + | ^^^^ +LL | struct Foo; + | ----------- not an enum + +error[E0517]: attribute should be applied to enum + --> $DIR/issue-74082.rs:6:8 + | +LL | #[repr(u128)] + | ^^^^ +LL | struct Bar; + | ----------- not an enum + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0517`. diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/meta.rs b/src/test/ui/rfc-2126-extern-absolute-paths/meta.rs index b3b9aeb8028e1..1fb5878ca2ace 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/meta.rs +++ b/src/test/ui/rfc-2126-extern-absolute-paths/meta.rs @@ -1,7 +1,7 @@ // edition:2018 -// Tests that `meta` is whitelisted, even if the crate doesn't exist -// yet (i.e., it causes a different error than `not-whitelisted.rs`). +// Tests that `meta` is allowed, even if the crate doesn't exist +// yet (i.e., it causes a different error than `not-allowed.rs`). use meta; //~ ERROR can't find crate for `meta` fn main() {} diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.rs b/src/test/ui/rfc-2126-extern-absolute-paths/not-allowed.rs similarity index 100% rename from src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.rs rename to src/test/ui/rfc-2126-extern-absolute-paths/not-allowed.rs diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/not-allowed.stderr similarity index 86% rename from src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr rename to src/test/ui/rfc-2126-extern-absolute-paths/not-allowed.stderr index f324378d4ca68..6d2b4508a0592 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/not-allowed.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `alloc` - --> $DIR/not-whitelisted.rs:5:5 + --> $DIR/not-allowed.rs:5:5 | LL | use alloc; | ^^^^^ no `alloc` external crate diff --git a/src/test/ui/sse2.rs b/src/test/ui/sse2.rs index 74f112464c75d..7726972b95b64 100644 --- a/src/test/ui/sse2.rs +++ b/src/test/ui/sse2.rs @@ -20,7 +20,7 @@ fn main() { assert!(cfg!(target_feature = "sse2"), "SSE2 was not detected as available on an x86 platform"); } - // check a negative case too -- whitelisted on x86, but not enabled by default + // check a negative case too -- allowed on x86, but not enabled by default assert!(cfg!(not(target_feature = "avx2")), "AVX2 shouldn't be detected as available by default on any platform"); } diff --git a/src/tools/clippy/clippy_lints/src/attrs.rs b/src/tools/clippy/clippy_lints/src/attrs.rs index 2505ff32fe523..3f7d6ba646770 100644 --- a/src/tools/clippy/clippy_lints/src/attrs.rs +++ b/src/tools/clippy/clippy_lints/src/attrs.rs @@ -72,7 +72,7 @@ declare_clippy_lint! { /// **What it does:** Checks for `extern crate` and `use` items annotated with /// lint attributes. /// - /// This lint whitelists `#[allow(unused_imports)]`, `#[allow(deprecated)]` and + /// This lint permits `#[allow(unused_imports)]`, `#[allow(deprecated)]` and /// `#[allow(unreachable_pub)]` on `use` items and `#[allow(unused_imports)]` on /// `extern crate` items with a `#[macro_use]` attribute. /// @@ -294,7 +294,7 @@ impl<'tcx> LateLintPass<'tcx> for Attributes { if let Some(ident) = attr.ident() { match &*ident.as_str() { "allow" | "warn" | "deny" | "forbid" => { - // whitelist `unused_imports`, `deprecated` and `unreachable_pub` for `use` items + // permit `unused_imports`, `deprecated` and `unreachable_pub` for `use` items // and `unused_imports` for `extern crate` items with `macro_use` for lint in lint_list { match item.kind { diff --git a/src/tools/clippy/clippy_lints/src/eq_op.rs b/src/tools/clippy/clippy_lints/src/eq_op.rs index ca921dcfdfe92..33a7898dfdc35 100644 --- a/src/tools/clippy/clippy_lints/src/eq_op.rs +++ b/src/tools/clippy/clippy_lints/src/eq_op.rs @@ -16,7 +16,7 @@ declare_clippy_lint! { /// **Known problems:** False negatives: We had some false positives regarding /// calls (notably [racer](/~https://github.com/phildawes/racer) had one instance /// of `x.pop() && x.pop()`), so we removed matching any function or method - /// calls. We may introduce a whitelist of known pure functions in the future. + /// calls. We may introduce an list of known pure functions in the future. /// /// **Example:** /// ```rust diff --git a/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs b/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs index 5d47f9425e3ef..29e5d4d166498 100644 --- a/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs +++ b/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs @@ -100,7 +100,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue { // Allow `Borrow` or functions to be taken by value let borrow_trait = need!(get_trait_def_id(cx, &paths::BORROW_TRAIT)); - let whitelisted_traits = [ + let allowed_traits = [ need!(cx.tcx.lang_items().fn_trait()), need!(cx.tcx.lang_items().fn_once_trait()), need!(cx.tcx.lang_items().fn_mut_trait()), @@ -184,7 +184,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue { if !is_self(arg); if !ty.is_mutable_ptr(); if !is_copy(cx, ty); - if !whitelisted_traits.iter().any(|&t| implements_trait(cx, ty, t, &[])); + if !allowed_traits.iter().any(|&t| implements_trait(cx, ty, t, &[])); if !implements_borrow_trait; if !all_borrowable_trait; diff --git a/src/tools/clippy/clippy_lints/src/non_expressive_names.rs b/src/tools/clippy/clippy_lints/src/non_expressive_names.rs index 5f14fe97afefa..17e166e44f385 100644 --- a/src/tools/clippy/clippy_lints/src/non_expressive_names.rs +++ b/src/tools/clippy/clippy_lints/src/non_expressive_names.rs @@ -78,7 +78,7 @@ struct ExistingName { interned: SymbolStr, span: Span, len: usize, - whitelist: &'static [&'static str], + exemptions: &'static [&'static str], } struct SimilarNamesLocalVisitor<'a, 'tcx> { @@ -117,7 +117,7 @@ impl<'a, 'tcx> SimilarNamesLocalVisitor<'a, 'tcx> { // this list contains lists of names that are allowed to be similar // the assumption is that no name is ever contained in multiple lists. #[rustfmt::skip] -const WHITELIST: &[&[&str]] = &[ +const EXEMPTIONS: &[&[&str]] = &[ &["parsed", "parser"], &["lhs", "rhs"], &["tx", "rx"], @@ -156,17 +156,17 @@ impl<'a, 'tcx, 'b> Visitor<'tcx> for SimilarNamesNameVisitor<'a, 'tcx, 'b> { } #[must_use] -fn get_whitelist(interned_name: &str) -> Option<&'static [&'static str]> { - for &allow in WHITELIST { - if whitelisted(interned_name, allow) { - return Some(allow); +fn get_exemptions(interned_name: &str) -> Option<&'static [&'static str]> { + for &list in EXEMPTIONS { + if exempted(interned_name, list) { + return Some(list); } } None } #[must_use] -fn whitelisted(interned_name: &str, list: &[&str]) -> bool { +fn exempted(interned_name: &str, list: &[&str]) -> bool { list.iter() .any(|&name| interned_name.starts_with(name) || interned_name.ends_with(name)) } @@ -212,7 +212,7 @@ impl<'a, 'tcx, 'b> SimilarNamesNameVisitor<'a, 'tcx, 'b> { return; } for existing_name in &self.0.names { - if whitelisted(&interned_name, existing_name.whitelist) { + if exempted(&interned_name, existing_name.exemptions) { continue; } let mut split_at = None; @@ -301,7 +301,7 @@ impl<'a, 'tcx, 'b> SimilarNamesNameVisitor<'a, 'tcx, 'b> { return; } self.0.names.push(ExistingName { - whitelist: get_whitelist(&interned_name).unwrap_or(&[]), + exemptions: get_exemptions(&interned_name).unwrap_or(&[]), interned: interned_name, span: ident.span, len: count, diff --git a/src/tools/clippy/clippy_lints/src/precedence.rs b/src/tools/clippy/clippy_lints/src/precedence.rs index 7dce23dd22306..23793678fa0e2 100644 --- a/src/tools/clippy/clippy_lints/src/precedence.rs +++ b/src/tools/clippy/clippy_lints/src/precedence.rs @@ -5,7 +5,7 @@ use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Spanned; -const ODD_FUNCTIONS_WHITELIST: [&str; 14] = [ +const ALLOWED_ODD_FUNCTIONS: [&str; 14] = [ "asin", "asinh", "atan", @@ -109,7 +109,7 @@ impl EarlyLintPass for Precedence { if let ExprKind::Lit(ref lit) = slf.kind { match lit.kind { LitKind::Int(..) | LitKind::Float(..) => { - if ODD_FUNCTIONS_WHITELIST + if ALLOWED_ODD_FUNCTIONS .iter() .any(|odd_function| **odd_function == *path_segment_str) { diff --git a/src/tools/clippy/clippy_lints/src/types.rs b/src/tools/clippy/clippy_lints/src/types.rs index b1345f0de5e4b..68f51f0afdccd 100644 --- a/src/tools/clippy/clippy_lints/src/types.rs +++ b/src/tools/clippy/clippy_lints/src/types.rs @@ -1256,7 +1256,7 @@ fn check_loss_of_sign(cx: &LateContext<'_>, expr: &Expr<'_>, op: &Expr<'_>, cast // don't lint for the result of methods that always return non-negative values if let ExprKind::MethodCall(ref path, _, _, _) = op.kind { let mut method_name = path.ident.name.as_str(); - let whitelisted_methods = ["abs", "checked_abs", "rem_euclid", "checked_rem_euclid"]; + let allowed_methods = ["abs", "checked_abs", "rem_euclid", "checked_rem_euclid"]; if_chain! { if method_name == "unwrap"; @@ -1267,7 +1267,7 @@ fn check_loss_of_sign(cx: &LateContext<'_>, expr: &Expr<'_>, op: &Expr<'_>, cast } } - if whitelisted_methods.iter().any(|&name| method_name == name) { + if allowed_methods.iter().any(|&name| method_name == name) { return; } } diff --git a/src/tools/clippy/tests/ui/crashes/whitelist/clippy.toml b/src/tools/clippy/tests/ui/crashes/allowlist/clippy.toml similarity index 100% rename from src/tools/clippy/tests/ui/crashes/whitelist/clippy.toml rename to src/tools/clippy/tests/ui/crashes/allowlist/clippy.toml diff --git a/src/tools/clippy/tests/ui/crashes/whitelist/conf_whitelisted.rs b/src/tools/clippy/tests/ui/crashes/allowlist/conf_allowlisted.rs similarity index 100% rename from src/tools/clippy/tests/ui/crashes/whitelist/conf_whitelisted.rs rename to src/tools/clippy/tests/ui/crashes/allowlist/conf_allowlisted.rs diff --git a/src/tools/clippy/tests/ui/needless_pass_by_value.rs b/src/tools/clippy/tests/ui/needless_pass_by_value.rs index e93a7fe2985b3..7a9ba55590dce 100644 --- a/src/tools/clippy/tests/ui/needless_pass_by_value.rs +++ b/src/tools/clippy/tests/ui/needless_pass_by_value.rs @@ -116,7 +116,7 @@ extern "C" fn ext(x: MaybeUninit) -> usize { unsafe { x.assume_init() } } -// whitelist RangeArgument +// exempt RangeArgument fn range>(range: T) { let _ = range.start_bound(); } diff --git a/src/tools/clippy/tests/ui/neg_cmp_op_on_partial_ord.rs b/src/tools/clippy/tests/ui/neg_cmp_op_on_partial_ord.rs index ca70e3b7148ef..0b47119527247 100644 --- a/src/tools/clippy/tests/ui/neg_cmp_op_on_partial_ord.rs +++ b/src/tools/clippy/tests/ui/neg_cmp_op_on_partial_ord.rs @@ -57,6 +57,6 @@ fn main() { // The macro always negates the result of the given comparison in its // internal check which automatically triggered the lint. As it's an // external macro there was no chance to do anything about it which led - // to a whitelisting of all external macros. + // to an exempting of all external macros. assert!(a_value < another_value); } diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 2aea4d22700f3..97272f1a9c1b6 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -401,7 +401,7 @@ fn configure_lldb(config: &Config) -> Option { } if let Some(lldb_version) = config.lldb_version.as_ref() { - if is_blacklisted_lldb_version(&lldb_version) { + if lldb_version == "350" { println!( "WARNING: The used version of LLDB ({}) has a \ known issue that breaks debuginfo tests. See \ @@ -979,7 +979,3 @@ fn extract_lldb_version(full_version_line: Option) -> (Option, b } (None, false) } - -fn is_blacklisted_lldb_version(version: &str) -> bool { - version == "350" -} diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs index 9e4e2c433fbed..74601f9e4c679 100644 --- a/src/tools/linkchecker/main.rs +++ b/src/tools/linkchecker/main.rs @@ -11,8 +11,8 @@ //! These values are then translated to file URLs if possible and then the //! destination is asserted to exist. //! -//! A few whitelisted exceptions are allowed as there's known bugs in rustdoc, -//! but this should catch the majority of "broken link" cases. +//! A few exceptions are allowed as there's known bugs in rustdoc, but this +//! should catch the majority of "broken link" cases. use std::collections::hash_map::Entry; use std::collections::{HashMap, HashSet}; @@ -118,7 +118,7 @@ fn check(cache: &mut Cache, root: &Path, file: &Path, errors: &mut bool) -> Opti } // Unfortunately we're not 100% full of valid links today to we need a few - // whitelists to get this past `make check` today. + // exceptions to get this past `make check` today. // FIXME(#32129) if file.ends_with("std/io/struct.IoSlice.html") || file.ends_with("std/string/struct.String.html") diff --git a/src/tools/rust-installer b/src/tools/rust-installer index 9f66c14c3f91a..d66f476b4d5e7 160000 --- a/src/tools/rust-installer +++ b/src/tools/rust-installer @@ -1 +1 @@ -Subproject commit 9f66c14c3f91a48a118c7817f434167b311c3515 +Subproject commit d66f476b4d5e7fdf1ec215c9ac16c923dc292324 diff --git a/src/tools/tidy/src/cargo.rs b/src/tools/tidy/src/cargo.rs index 7c45efba5ea08..7bdd78a91e7de 100644 --- a/src/tools/tidy/src/cargo.rs +++ b/src/tools/tidy/src/cargo.rs @@ -73,8 +73,8 @@ fn verify(tomlfile: &Path, libfile: &Path, bad: &mut bool) { // This is intentional -- this dependency just makes the crate available // for others later on. - let whitelisted = krate.starts_with("panic"); - if toml.contains("name = \"std\"") && whitelisted { + let allowed = krate.starts_with("panic"); + if toml.contains("name = \"std\"") && allowed { continue; } diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 4622e15a1cae8..b7d3d428cd283 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -49,14 +49,14 @@ const EXCEPTIONS: &[(&str, &str)] = &[ /// these and all their dependencies *must not* be in the exception list. const RUNTIME_CRATES: &[&str] = &["std", "core", "alloc", "test", "panic_abort", "panic_unwind"]; -/// Which crates to check against the whitelist? -const WHITELIST_CRATES: &[&str] = &["rustc_middle", "rustc_codegen_llvm"]; +/// Crates whose dependencies must be explicitly permitted. +const RESTRICTED_DEPENDENCY_CRATES: &[&str] = &["rustc_middle", "rustc_codegen_llvm"]; -/// Whitelist of crates rustc is allowed to depend on. Avoid adding to the list if possible. +/// Crates rustc is allowed to depend on. Avoid adding to the list if possible. /// /// This list is here to provide a speed-bump to adding a new dependency to /// rustc. Please check with the compiler team before adding an entry. -const WHITELIST: &[&str] = &[ +const PERMITTED_DEPENDENCIES: &[&str] = &[ "adler32", "aho-corasick", "annotate-snippets", @@ -190,7 +190,7 @@ pub fn check(path: &Path, cargo: &Path, bad: &mut bool) { .features(cargo_metadata::CargoOpt::AllFeatures); let metadata = t!(cmd.exec()); check_exceptions(&metadata, bad); - check_whitelist(&metadata, bad); + check_dependencies(&metadata, bad); check_crate_duplicate(&metadata, bad); } @@ -272,36 +272,37 @@ fn check_exceptions(metadata: &Metadata, bad: &mut bool) { } } -/// Checks the dependency of `WHITELIST_CRATES` at the given path. Changes `bad` to `true` if a -/// check failed. +/// Checks the dependency of `RESTRICTED_DEPENDENCY_CRATES` at the given path. Changes `bad` to +/// `true` if a check failed. /// -/// Specifically, this checks that the dependencies are on the `WHITELIST`. -fn check_whitelist(metadata: &Metadata, bad: &mut bool) { - // Check that the WHITELIST does not have unused entries. - for name in WHITELIST { +/// Specifically, this checks that the dependencies are on the `PERMITTED_DEPENDENCIES`. +fn check_dependencies(metadata: &Metadata, bad: &mut bool) { + // Check that the PERMITTED_DEPENDENCIES does not have unused entries. + for name in PERMITTED_DEPENDENCIES { if !metadata.packages.iter().any(|p| p.name == *name) { println!( - "could not find whitelisted package `{}`\n\ - Remove from WHITELIST list if it is no longer used.", + "could not find allowed package `{}`\n\ + Remove from PERMITTED_DEPENDENCIES list if it is no longer used.", name ); *bad = true; } } - // Get the whitelist in a convenient form. - let whitelist: HashSet<_> = WHITELIST.iter().cloned().collect(); + // Get the list in a convenient form. + let permitted_dependencies: HashSet<_> = PERMITTED_DEPENDENCIES.iter().cloned().collect(); // Check dependencies. let mut visited = BTreeSet::new(); let mut unapproved = BTreeSet::new(); - for &krate in WHITELIST_CRATES.iter() { + for &krate in RESTRICTED_DEPENDENCY_CRATES.iter() { let pkg = pkg_from_name(metadata, krate); - let mut bad = check_crate_whitelist(&whitelist, metadata, &mut visited, pkg); + let mut bad = + check_crate_dependencies(&permitted_dependencies, metadata, &mut visited, pkg); unapproved.append(&mut bad); } if !unapproved.is_empty() { - println!("Dependencies not on the whitelist:"); + println!("Dependencies not explicitly permitted:"); for dep in unapproved { println!("* {}", dep); } @@ -310,9 +311,9 @@ fn check_whitelist(metadata: &Metadata, bad: &mut bool) { } /// Checks the dependencies of the given crate from the given cargo metadata to see if they are on -/// the whitelist. Returns a list of illegal dependencies. -fn check_crate_whitelist<'a>( - whitelist: &'a HashSet<&'static str>, +/// the list of permitted dependencies. Returns a list of disallowed dependencies. +fn check_crate_dependencies<'a>( + permitted_dependencies: &'a HashSet<&'static str>, metadata: &'a Metadata, visited: &mut BTreeSet<&'a PackageId>, krate: &'a Package, @@ -327,10 +328,10 @@ fn check_crate_whitelist<'a>( visited.insert(&krate.id); - // If this path is in-tree, we don't require it to be on the whitelist. + // If this path is in-tree, we don't require it to be explicitly permitted. if krate.source.is_some() { - // If this dependency is not on `WHITELIST`, add to bad set. - if !whitelist.contains(krate.name.as_str()) { + // If this dependency is not on `PERMITTED_DEPENDENCIES`, add to bad set. + if !permitted_dependencies.contains(krate.name.as_str()) { unapproved.insert(&krate.id); } } @@ -339,7 +340,7 @@ fn check_crate_whitelist<'a>( let to_check = deps_of(metadata, &krate.id); for dep in to_check { - let mut bad = check_crate_whitelist(whitelist, metadata, visited, dep); + let mut bad = check_crate_dependencies(permitted_dependencies, metadata, visited, dep); unapproved.append(&mut bad); } diff --git a/src/tools/tidy/src/error_codes_check.rs b/src/tools/tidy/src/error_codes_check.rs index f7fd0c670d704..3af71f69d2457 100644 --- a/src/tools/tidy/src/error_codes_check.rs +++ b/src/tools/tidy/src/error_codes_check.rs @@ -7,7 +7,7 @@ use std::fs::read_to_string; use std::path::Path; // A few of those error codes can't be tested but all the others can and *should* be tested! -const WHITELIST: &[&str] = &[ +const EXEMPTED_FROM_TEST: &[&str] = &[ "E0183", "E0227", "E0279", "E0280", "E0311", "E0313", "E0314", "E0315", "E0377", "E0456", "E0461", "E0462", "E0464", "E0465", "E0472", "E0473", "E0474", "E0475", "E0476", "E0479", "E0480", "E0481", "E0482", "E0483", "E0484", "E0485", "E0486", "E0487", "E0488", "E0489", @@ -166,7 +166,7 @@ pub fn check(path: &Path, bad: &mut bool) { println!("Found {} error codes", error_codes.len()); for (err_code, nb) in &error_codes { - if !*nb && !WHITELIST.contains(&err_code.as_str()) { + if !*nb && !EXEMPTED_FROM_TEST.contains(&err_code.as_str()) { errors.push(format!("Error code {} needs to have at least one UI test!", err_code)); } } diff --git a/src/tools/tidy/src/extdeps.rs b/src/tools/tidy/src/extdeps.rs index e3f92d4806152..4d666a502a160 100644 --- a/src/tools/tidy/src/extdeps.rs +++ b/src/tools/tidy/src/extdeps.rs @@ -3,8 +3,8 @@ use std::fs; use std::path::Path; -/// List of whitelisted sources for packages. -const WHITELISTED_SOURCES: &[&str] = &["\"registry+/~https://github.com/rust-lang/crates.io-index\""]; +/// List of allowed sources for packages. +const ALLOWED_SOURCES: &[&str] = &["\"registry+/~https://github.com/rust-lang/crates.io-index\""]; /// Checks for external package sources. pub fn check(path: &Path, bad: &mut bool) { @@ -24,8 +24,8 @@ pub fn check(path: &Path, bad: &mut bool) { // Extract source value. let source = line.splitn(2, '=').nth(1).unwrap().trim(); - // Ensure source is whitelisted. - if !WHITELISTED_SOURCES.contains(&&*source) { + // Ensure source is allowed. + if !ALLOWED_SOURCES.contains(&&*source) { println!("invalid source: {}", source); *bad = true; }