diff --git a/Cargo.lock b/Cargo.lock
index 10889139e8d6..979198cece80 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3537,6 +3537,7 @@ dependencies = [
"ar_archive_writer",
"arrayvec",
"bitflags",
+ "bstr",
"cc",
"either",
"itertools",
diff --git a/RELEASES.md b/RELEASES.md
index d8d284ca1fa8..2da6ed3f1006 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -573,6 +573,7 @@ Libraries
- [Replace sort implementations with stable `driftsort` and unstable `ipnsort`.](https://github.com/rust-lang/rust/pull/124032/) All `slice::sort*` and `slice::select_nth*` methods are expected to see significant performance improvements. See the [research project](https://github.com/Voultapher/sort-research-rs) for more details.
- [Document behavior of `create_dir_all` with respect to empty paths.](https://github.com/rust-lang/rust/pull/125112/)
- [Fix interleaved output in the default panic hook when multiple threads panic simultaneously.](https://github.com/rust-lang/rust/pull/127397/)
+- Fix `Command`'s batch files argument escaping not working when file name has trailing whitespace or periods (CVE-2024-43402).
diff --git a/compiler/rustc_attr_data_structures/src/attributes.rs b/compiler/rustc_attr_data_structures/src/attributes.rs
index def6b16ee8ae..b4027a096c53 100644
--- a/compiler/rustc_attr_data_structures/src/attributes.rs
+++ b/compiler/rustc_attr_data_structures/src/attributes.rs
@@ -35,13 +35,25 @@ pub enum InstructionSetAttr {
ArmT32,
}
-#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
+#[derive(Clone, Encodable, Decodable, Debug, PartialEq, Eq, HashStable_Generic, Default)]
pub enum OptimizeAttr {
- None,
+ /// No `#[optimize(..)]` attribute
+ #[default]
+ Default,
+ /// `#[optimize(none)]`
+ DoNotOptimize,
+ /// `#[optimize(speed)]`
Speed,
+ /// `#[optimize(size)]`
Size,
}
+impl OptimizeAttr {
+ pub fn do_not_optimize(&self) -> bool {
+ matches!(self, Self::DoNotOptimize)
+ }
+}
+
#[derive(Clone, Debug, Encodable, Decodable)]
pub enum DiagnosticAttribute {
// tidy-alphabetical-start
diff --git a/compiler/rustc_borrowck/messages.ftl b/compiler/rustc_borrowck/messages.ftl
index ada20e5c614f..c00e6dde9196 100644
--- a/compiler/rustc_borrowck/messages.ftl
+++ b/compiler/rustc_borrowck/messages.ftl
@@ -92,6 +92,9 @@ borrowck_lifetime_constraints_error =
borrowck_limitations_implies_static =
due to current limitations in the borrow checker, this implies a `'static` lifetime
+borrowck_long_type_consider_verbose = consider using `--verbose` to print the full type name to the console
+borrowck_long_type_full_path = the full type name has been written to '{$path}'
+
borrowck_move_closure_suggestion =
consider adding 'move' keyword before the nested closure
diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
index d020244bf55e..07dcbba019ad 100644
--- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
@@ -289,6 +289,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
None => "value".to_owned(),
};
if needs_note {
+ let mut path = None;
+ let ty = self.infcx.tcx.short_ty_string(ty, &mut path);
if let Some(local) = place.as_local() {
let span = self.body.local_decls[local].source_info.span;
err.subdiagnostic(crate::session_diagnostics::TypeNoCopy::Label {
@@ -304,6 +306,11 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
place: ¬e_msg,
});
};
+ if let Some(path) = path {
+ err.subdiagnostic(crate::session_diagnostics::LongTypePath {
+ path: path.display().to_string(),
+ });
+ }
}
if let UseSpans::FnSelfUse {
diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs
index beacbdbd3fa7..14a900f38e92 100644
--- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs
@@ -596,12 +596,19 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
self.suggest_cloning(err, place_ty, expr, None);
}
+ let mut path = None;
+ let ty = self.infcx.tcx.short_ty_string(place_ty, &mut path);
err.subdiagnostic(crate::session_diagnostics::TypeNoCopy::Label {
is_partial_move: false,
- ty: place_ty,
+ ty,
place: &place_desc,
span,
});
+ if let Some(path) = path {
+ err.subdiagnostic(crate::session_diagnostics::LongTypePath {
+ path: path.display().to_string(),
+ });
+ }
} else {
binds_to.sort();
binds_to.dedup();
@@ -628,12 +635,19 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
self.suggest_cloning(err, place_ty, expr, Some(use_spans));
}
+ let mut path = None;
+ let ty = self.infcx.tcx.short_ty_string(place_ty, &mut path);
err.subdiagnostic(crate::session_diagnostics::TypeNoCopy::Label {
is_partial_move: false,
- ty: place_ty,
+ ty,
place: &place_desc,
span: use_span,
});
+ if let Some(path) = path {
+ err.subdiagnostic(crate::session_diagnostics::LongTypePath {
+ path: path.display().to_string(),
+ });
+ }
use_spans.args_subdiag(err, |args_span| {
crate::session_diagnostics::CaptureArgLabel::MoveOutPlace {
@@ -831,12 +845,19 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
self.suggest_cloning(err, bind_to.ty, expr, None);
}
+ let mut path = None;
+ let ty = self.infcx.tcx.short_ty_string(bind_to.ty, &mut path);
err.subdiagnostic(crate::session_diagnostics::TypeNoCopy::Label {
is_partial_move: false,
- ty: bind_to.ty,
+ ty,
place: place_desc,
span: binding_span,
});
+ if let Some(path) = path {
+ err.subdiagnostic(crate::session_diagnostics::LongTypePath {
+ path: path.display().to_string(),
+ });
+ }
}
}
diff --git a/compiler/rustc_borrowck/src/session_diagnostics.rs b/compiler/rustc_borrowck/src/session_diagnostics.rs
index 4be5d0dbf428..2c37d2bc1236 100644
--- a/compiler/rustc_borrowck/src/session_diagnostics.rs
+++ b/compiler/rustc_borrowck/src/session_diagnostics.rs
@@ -459,17 +459,24 @@ pub(crate) enum OnClosureNote<'a> {
}
#[derive(Subdiagnostic)]
-pub(crate) enum TypeNoCopy<'a, 'tcx> {
+#[note(borrowck_long_type_full_path)]
+#[note(borrowck_long_type_consider_verbose)]
+pub(crate) struct LongTypePath {
+ pub(crate) path: String,
+}
+
+#[derive(Subdiagnostic)]
+pub(crate) enum TypeNoCopy<'a> {
#[label(borrowck_ty_no_impl_copy)]
Label {
is_partial_move: bool,
- ty: Ty<'tcx>,
+ ty: String,
place: &'a str,
#[primary_span]
span: Span,
},
#[note(borrowck_ty_no_impl_copy)]
- Note { is_partial_move: bool, ty: Ty<'tcx>, place: &'a str },
+ Note { is_partial_move: bool, ty: String, place: &'a str },
}
#[derive(Diagnostic)]
diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs
index 95e0481b035e..3d7afa17bdf3 100644
--- a/compiler/rustc_codegen_llvm/src/attributes.rs
+++ b/compiler/rustc_codegen_llvm/src/attributes.rs
@@ -333,9 +333,12 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
let mut to_add = SmallVec::<[_; 16]>::new();
match codegen_fn_attrs.optimize {
- OptimizeAttr::None => {
+ OptimizeAttr::Default => {
to_add.extend(default_optimisation_attrs(cx));
}
+ OptimizeAttr::DoNotOptimize => {
+ to_add.push(llvm::AttributeKind::OptimizeNone.create_attr(cx.llcx));
+ }
OptimizeAttr::Size => {
to_add.push(llvm::AttributeKind::MinSize.create_attr(cx.llcx));
to_add.push(llvm::AttributeKind::OptimizeForSize.create_attr(cx.llcx));
@@ -343,12 +346,12 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
OptimizeAttr::Speed => {}
}
- let inline =
- if codegen_fn_attrs.inline == InlineAttr::None && instance.def.requires_inline(cx.tcx) {
- InlineAttr::Hint
- } else {
- codegen_fn_attrs.inline
- };
+ // `optnone` requires `noinline`
+ let inline = match (codegen_fn_attrs.inline, &codegen_fn_attrs.optimize) {
+ (_, OptimizeAttr::DoNotOptimize) => InlineAttr::Never,
+ (InlineAttr::None, _) if instance.def.requires_inline(cx.tcx) => InlineAttr::Hint,
+ (inline, _) => inline,
+ };
to_add.extend(inline_attr(cx, inline));
// The `uwtable` attribute according to LLVM is:
diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml
index b6b453d069e6..b22357acdc26 100644
--- a/compiler/rustc_codegen_ssa/Cargo.toml
+++ b/compiler/rustc_codegen_ssa/Cargo.toml
@@ -8,6 +8,7 @@ edition = "2021"
ar_archive_writer = "0.4.2"
arrayvec = { version = "0.7", default-features = false }
bitflags = "2.4.1"
+bstr = "1.11.3"
# Pinned so `cargo update` bumps don't cause breakage. Please also update the
# `cc` in `rustc_llvm` if you update the `cc` here.
cc = "=1.2.7"
diff --git a/compiler/rustc_codegen_ssa/messages.ftl b/compiler/rustc_codegen_ssa/messages.ftl
index a4c50dcc1356..de37de09f5a5 100644
--- a/compiler/rustc_codegen_ssa/messages.ftl
+++ b/compiler/rustc_codegen_ssa/messages.ftl
@@ -183,6 +183,8 @@ codegen_ssa_linker_file_stem = couldn't extract file stem from specified linker
codegen_ssa_linker_not_found = linker `{$linker_path}` not found
.note = {$error}
+codegen_ssa_linker_output = {$inner}
+
codegen_ssa_linker_unsupported_modifier = `as-needed` modifier not supported for current linker
codegen_ssa_linking_failed = linking with `{$linker_path}` failed: {$exit_status}
diff --git a/compiler/rustc_codegen_ssa/src/back/command.rs b/compiler/rustc_codegen_ssa/src/back/command.rs
index b3c5b86ccf43..63023fdba20f 100644
--- a/compiler/rustc_codegen_ssa/src/back/command.rs
+++ b/compiler/rustc_codegen_ssa/src/back/command.rs
@@ -13,6 +13,7 @@ pub(crate) struct Command {
args: Vec,
env: Vec<(OsString, OsString)>,
env_remove: Vec,
+ env_clear: bool,
}
#[derive(Clone)]
@@ -36,7 +37,13 @@ impl Command {
}
fn _new(program: Program) -> Command {
- Command { program, args: Vec::new(), env: Vec::new(), env_remove: Vec::new() }
+ Command {
+ program,
+ args: Vec::new(),
+ env: Vec::new(),
+ env_remove: Vec::new(),
+ env_clear: false,
+ }
}
pub(crate) fn arg>(&mut self, arg: P) -> &mut Command {
@@ -79,6 +86,11 @@ impl Command {
self
}
+ pub(crate) fn env_clear(&mut self) -> &mut Command {
+ self.env_clear = true;
+ self
+ }
+
fn _env_remove(&mut self, key: &OsStr) {
self.env_remove.push(key.to_owned());
}
@@ -106,6 +118,9 @@ impl Command {
for k in &self.env_remove {
ret.env_remove(k);
}
+ if self.env_clear {
+ ret.env_clear();
+ }
ret
}
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index df35b5e8426f..105a4cb81f0d 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -15,12 +15,14 @@ use rustc_ast::CRATE_NODE_ID;
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
use rustc_data_structures::memmap::Mmap;
use rustc_data_structures::temp_dir::MaybeTempDir;
-use rustc_errors::DiagCtxtHandle;
+use rustc_errors::{DiagCtxtHandle, LintDiagnostic};
use rustc_fs_util::{fix_windows_verbatim_for_gcc, try_canonicalize};
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
+use rustc_macros::LintDiagnostic;
use rustc_metadata::fs::{METADATA_FILENAME, copy_to_stdout, emit_wrapper_file};
use rustc_metadata::{find_native_static_library, walk_native_lib_search_dirs};
use rustc_middle::bug;
+use rustc_middle::lint::lint_level;
use rustc_middle::middle::debugger_visualizer::DebuggerVisualizerFile;
use rustc_middle::middle::dependency_format::Linkage;
use rustc_middle::middle::exported_symbols::SymbolExportKind;
@@ -29,6 +31,7 @@ use rustc_session::config::{
OutputType, PrintKind, SplitDwarfKind, Strip,
};
use rustc_session::cstore::DllImport;
+use rustc_session::lint::builtin::LINKER_MESSAGES;
use rustc_session::output::{check_file_is_writeable, invalid_output_for_target, out_filename};
use rustc_session::search_paths::PathKind;
use rustc_session::utils::NativeLibKind;
@@ -749,6 +752,14 @@ fn link_dwarf_object(sess: &Session, cg_results: &CodegenResults, executable_out
}
}
+#[derive(LintDiagnostic)]
+#[diag(codegen_ssa_linker_output)]
+/// Translating this is kind of useless. We don't pass translation flags to the linker, so we'd just
+/// end up with inconsistent languages within the same diagnostic.
+struct LinkerOutput {
+ inner: String,
+}
+
/// Create a dynamic library or executable.
///
/// This will invoke the system linker/cc to create the resulting file. This links to all upstream
@@ -981,6 +992,11 @@ fn link_natively(
match prog {
Ok(prog) => {
+ let is_msvc_link_exe = sess.target.is_like_msvc
+ && flavor == LinkerFlavor::Msvc(Lld::No)
+ // Match exactly "link.exe"
+ && linker_path.to_str() == Some("link.exe");
+
if !prog.status.success() {
let mut output = prog.stderr.clone();
output.extend_from_slice(&prog.stdout);
@@ -991,22 +1007,16 @@ fn link_natively(
command: cmd,
escaped_output,
verbose: sess.opts.verbose,
+ sysroot_dir: sess.sysroot.clone(),
};
sess.dcx().emit_err(err);
// If MSVC's `link.exe` was expected but the return code
// is not a Microsoft LNK error then suggest a way to fix or
// install the Visual Studio build tools.
if let Some(code) = prog.status.code() {
- if sess.target.is_like_msvc
- && flavor == LinkerFlavor::Msvc(Lld::No)
- // Respect the command line override
- && sess.opts.cg.linker.is_none()
- // Match exactly "link.exe"
- && linker_path.to_str() == Some("link.exe")
- // All Microsoft `link.exe` linking error codes are
- // four digit numbers in the range 1000 to 9999 inclusive
- && (code < 1000 || code > 9999)
- {
+ // All Microsoft `link.exe` linking ror codes are
+ // four digit numbers in the range 1000 to 9999 inclusive
+ if is_msvc_link_exe && (code < 1000 || code > 9999) {
let is_vs_installed = windows_registry::find_vs_version().is_ok();
let has_linker =
windows_registry::find_tool(&sess.target.arch, "link.exe").is_some();
@@ -1028,8 +1038,49 @@ fn link_natively(
sess.dcx().abort_if_errors();
}
- info!("linker stderr:\n{}", escape_string(&prog.stderr));
- info!("linker stdout:\n{}", escape_string(&prog.stdout));
+
+ let stderr = escape_string(&prog.stderr);
+ let mut stdout = escape_string(&prog.stdout);
+ info!("linker stderr:\n{}", &stderr);
+ info!("linker stdout:\n{}", &stdout);
+
+ // Hide some progress messages from link.exe that we don't care about.
+ // See https://github.com/chromium/chromium/blob/bfa41e41145ffc85f041384280caf2949bb7bd72/build/toolchain/win/tool_wrapper.py#L144-L146
+ if is_msvc_link_exe {
+ if let Ok(str) = str::from_utf8(&prog.stdout) {
+ let mut output = String::with_capacity(str.len());
+ for line in stdout.lines() {
+ if line.starts_with(" Creating library")
+ || line.starts_with("Generating code")
+ || line.starts_with("Finished generating code")
+ {
+ continue;
+ }
+ output += line;
+ output += "\r\n"
+ }
+ stdout = escape_string(output.trim().as_bytes())
+ }
+ }
+
+ let (level, src) = codegen_results.crate_info.lint_levels.linker_messages;
+ let lint = |msg| {
+ lint_level(sess, LINKER_MESSAGES, level, src, None, |diag| {
+ LinkerOutput { inner: msg }.decorate_lint(diag)
+ })
+ };
+
+ if !prog.stderr.is_empty() {
+ // We already print `warning:` at the start of the diagnostic. Remove it from the linker output if present.
+ let stderr = stderr
+ .strip_prefix("warning: ")
+ .unwrap_or(&stderr)
+ .replace(": warning: ", ": ");
+ lint(format!("linker stderr: {stderr}"));
+ }
+ if !stdout.is_empty() {
+ lint(format!("linker stdout: {}", stdout))
+ }
}
Err(e) => {
let linker_not_found = e.kind() == io::ErrorKind::NotFound;
diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs
index 83724af604d1..014bdeb46ad5 100644
--- a/compiler/rustc_codegen_ssa/src/base.rs
+++ b/compiler/rustc_codegen_ssa/src/base.rs
@@ -44,7 +44,8 @@ use crate::mir::operand::OperandValue;
use crate::mir::place::PlaceRef;
use crate::traits::*;
use crate::{
- CachedModuleCodegen, CompiledModule, CrateInfo, ModuleCodegen, ModuleKind, errors, meth, mir,
+ CachedModuleCodegen, CodegenLintLevels, CompiledModule, CrateInfo, ModuleCodegen, ModuleKind,
+ errors, meth, mir,
};
pub(crate) fn bin_op_to_icmp_predicate(op: BinOp, signed: bool) -> IntPredicate {
@@ -924,6 +925,7 @@ impl CrateInfo {
dependency_formats: Lrc::clone(tcx.dependency_formats(())),
windows_subsystem,
natvis_debugger_visualizers: Default::default(),
+ lint_levels: CodegenLintLevels::from_tcx(tcx),
};
info.native_libraries.reserve(n_crates);
@@ -1053,10 +1055,7 @@ pub(crate) fn provide(providers: &mut Providers) {
let any_for_speed = defids.items().any(|id| {
let CodegenFnAttrs { optimize, .. } = tcx.codegen_fn_attrs(*id);
- match optimize {
- attr::OptimizeAttr::None | attr::OptimizeAttr::Size => false,
- attr::OptimizeAttr::Speed => true,
- }
+ matches!(optimize, attr::OptimizeAttr::Speed)
});
if any_for_speed {
diff --git a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs
index 1daa17fbaf34..a0bc2d4ea48f 100644
--- a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs
+++ b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs
@@ -575,7 +575,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
codegen_fn_attrs.inline = InlineAttr::Never;
}
- codegen_fn_attrs.optimize = attrs.iter().fold(OptimizeAttr::None, |ia, attr| {
+ codegen_fn_attrs.optimize = attrs.iter().fold(OptimizeAttr::Default, |ia, attr| {
if !attr.has_name(sym::optimize) {
return ia;
}
@@ -587,17 +587,19 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
inline_span = Some(attr.span);
if items.len() != 1 {
err(attr.span, "expected one argument");
- OptimizeAttr::None
+ OptimizeAttr::Default
} else if list_contains_name(items, sym::size) {
OptimizeAttr::Size
} else if list_contains_name(items, sym::speed) {
OptimizeAttr::Speed
+ } else if list_contains_name(items, sym::none) {
+ OptimizeAttr::DoNotOptimize
} else {
err(items[0].span(), "invalid argument");
- OptimizeAttr::None
+ OptimizeAttr::Default
}
} else {
- OptimizeAttr::None
+ OptimizeAttr::Default
}
});
diff --git a/compiler/rustc_codegen_ssa/src/errors.rs b/compiler/rustc_codegen_ssa/src/errors.rs
index c7213bbc801f..5e684632fb24 100644
--- a/compiler/rustc_codegen_ssa/src/errors.rs
+++ b/compiler/rustc_codegen_ssa/src/errors.rs
@@ -351,6 +351,7 @@ pub(crate) struct LinkingFailed<'a> {
pub command: Command,
pub escaped_output: String,
pub verbose: bool,
+ pub sysroot_dir: PathBuf,
}
impl Diagnostic<'_, G> for LinkingFailed<'_> {
@@ -364,6 +365,8 @@ impl Diagnostic<'_, G> for LinkingFailed<'_> {
if self.verbose {
diag.note(format!("{:?}", self.command));
} else {
+ self.command.env_clear();
+
enum ArgGroup {
Regular(OsString),
Objects(usize),
@@ -398,26 +401,55 @@ impl Diagnostic<'_, G> for LinkingFailed<'_> {
args.push(ArgGroup::Regular(arg));
}
}
- self.command.args(args.into_iter().map(|arg_group| match arg_group {
- ArgGroup::Regular(arg) => arg,
- ArgGroup::Objects(n) => OsString::from(format!("<{n} object files omitted>")),
- ArgGroup::Rlibs(dir, rlibs) => {
- let mut arg = dir.into_os_string();
- arg.push("/{");
- let mut first = true;
- for rlib in rlibs {
- if !first {
- arg.push(",");
+ let crate_hash = regex::bytes::Regex::new(r"-[0-9a-f]+\.rlib$").unwrap();
+ self.command.args(args.into_iter().map(|arg_group| {
+ match arg_group {
+ // SAFETY: we are only matching on ASCII, not any surrogate pairs, so any replacements we do will still be valid.
+ ArgGroup::Regular(arg) => unsafe {
+ use bstr::ByteSlice;
+ OsString::from_encoded_bytes_unchecked(
+ arg.as_encoded_bytes().replace(
+ self.sysroot_dir.as_os_str().as_encoded_bytes(),
+ b"",
+ ),
+ )
+ },
+ ArgGroup::Objects(n) => OsString::from(format!("<{n} object files omitted>")),
+ ArgGroup::Rlibs(mut dir, rlibs) => {
+ let is_sysroot_dir = match dir.strip_prefix(&self.sysroot_dir) {
+ Ok(short) => {
+ dir = Path::new("").join(short);
+ true
+ }
+ Err(_) => false,
+ };
+ let mut arg = dir.into_os_string();
+ arg.push("/{");
+ let mut first = true;
+ for mut rlib in rlibs {
+ if !first {
+ arg.push(",");
+ }
+ first = false;
+ if is_sysroot_dir {
+ // SAFETY: Regex works one byte at a type, and our regex will not match surrogate pairs (because it only matches ascii).
+ rlib = unsafe {
+ OsString::from_encoded_bytes_unchecked(
+ crate_hash
+ .replace(rlib.as_encoded_bytes(), b"-*")
+ .into_owned(),
+ )
+ };
+ }
+ arg.push(rlib);
}
- first = false;
- arg.push(rlib);
+ arg.push("}.rlib");
+ arg
}
- arg.push("}");
- arg
}
}));
- diag.note(format!("{:?}", self.command));
+ diag.note(format!("{:?}", self.command).trim_start_matches("env -i").to_owned());
diag.note("some arguments are omitted. use `--verbose` to show all linker arguments");
}
diff --git a/compiler/rustc_codegen_ssa/src/lib.rs b/compiler/rustc_codegen_ssa/src/lib.rs
index 65c6067c7406..40299ae26308 100644
--- a/compiler/rustc_codegen_ssa/src/lib.rs
+++ b/compiler/rustc_codegen_ssa/src/lib.rs
@@ -29,18 +29,23 @@ use rustc_ast as ast;
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
use rustc_data_structures::sync::Lrc;
use rustc_data_structures::unord::UnordMap;
+use rustc_hir::CRATE_HIR_ID;
use rustc_hir::def_id::CrateNum;
use rustc_macros::{Decodable, Encodable, HashStable};
use rustc_middle::dep_graph::WorkProduct;
+use rustc_middle::lint::LintLevelSource;
use rustc_middle::middle::debugger_visualizer::DebuggerVisualizerFile;
use rustc_middle::middle::dependency_format::Dependencies;
use rustc_middle::middle::exported_symbols::SymbolExportKind;
+use rustc_middle::ty::TyCtxt;
use rustc_middle::util::Providers;
use rustc_serialize::opaque::{FileEncoder, MemDecoder};
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
use rustc_session::Session;
use rustc_session::config::{CrateType, OutputFilenames, OutputType, RUST_CGU_EXT};
use rustc_session::cstore::{self, CrateSource};
+use rustc_session::lint::Level;
+use rustc_session::lint::builtin::LINKER_MESSAGES;
use rustc_session::utils::NativeLibKind;
use rustc_span::Symbol;
@@ -200,6 +205,7 @@ pub struct CrateInfo {
pub dependency_formats: Lrc,
pub windows_subsystem: Option,
pub natvis_debugger_visualizers: BTreeSet,
+ pub lint_levels: CodegenLintLevels,
}
#[derive(Encodable, Decodable)]
@@ -302,3 +308,19 @@ impl CodegenResults {
Ok((codegen_results, outputs))
}
}
+
+/// A list of lint levels used in codegen.
+///
+/// When using `-Z link-only`, we don't have access to the tcx and must work
+/// solely from the `.rlink` file. `Lint`s are defined too early to be encodeable.
+/// Instead, encode exactly the information we need.
+#[derive(Copy, Clone, Debug, Encodable, Decodable)]
+pub struct CodegenLintLevels {
+ linker_messages: (Level, LintLevelSource),
+}
+
+impl CodegenLintLevels {
+ pub fn from_tcx(tcx: TyCtxt<'_>) -> Self {
+ Self { linker_messages: tcx.lint_level_at_node(LINKER_MESSAGES, CRATE_HIR_ID) }
+ }
+}
diff --git a/compiler/rustc_const_eval/messages.ftl b/compiler/rustc_const_eval/messages.ftl
index d4bfb781320d..485c8696342a 100644
--- a/compiler/rustc_const_eval/messages.ftl
+++ b/compiler/rustc_const_eval/messages.ftl
@@ -416,7 +416,7 @@ const_eval_unsized_local = unsized locals are not supported
const_eval_unstable_const_fn = `{$def_path}` is not yet stable as a const fn
const_eval_unstable_in_stable_exposed =
const function that might be (indirectly) exposed to stable cannot use `#[feature({$gate})]`
- .is_function_call = mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features
+ .is_function_call = mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features
.unstable_sugg = if the {$is_function_call2 ->
[true] caller
*[false] function
diff --git a/compiler/rustc_error_codes/src/error_codes/E0393.md b/compiler/rustc_error_codes/src/error_codes/E0393.md
index 50225b25163f..c72608159051 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0393.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0393.md
@@ -3,12 +3,10 @@ A type parameter which references `Self` in its default value was not specified.
Erroneous code example:
```compile_fail,E0393
-trait A {}
+trait A {}
-fn together_we_will_rule_the_galaxy(son: &A) {}
-// error: the type parameter `T` must be explicitly specified in an
-// object type because its default value `Self` references the
-// type `Self`
+fn together_we_will_rule_the_galaxy(son: &dyn A) {}
+// error: the type parameter `T` must be explicitly specified
```
A trait object is defined over a single, fully-defined trait. With a regular
@@ -23,7 +21,7 @@ disallowed. Making the trait concrete by explicitly specifying the value of the
defaulted parameter will fix this issue. Fixed example:
```
-trait A {}
+trait A {}
-fn together_we_will_rule_the_galaxy(son: &A) {} // Ok!
+fn together_we_will_rule_the_galaxy(son: &dyn A) {} // Ok!
```
diff --git a/compiler/rustc_error_codes/src/error_codes/E0433.md b/compiler/rustc_error_codes/src/error_codes/E0433.md
index 5a64c13c9af5..36e4b66e8dcd 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0433.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0433.md
@@ -19,7 +19,7 @@ If you've expected to use a crate name:
```compile_fail
use ferris_wheel::BigO;
-// error: failed to resolve: use of undeclared crate or module `ferris_wheel`
+// error: failed to resolve: use of undeclared module or unlinked crate
```
Make sure the crate has been added as a dependency in `Cargo.toml`.
diff --git a/compiler/rustc_errors/src/json.rs b/compiler/rustc_errors/src/json.rs
index c1188665a05f..95c81fc5f448 100644
--- a/compiler/rustc_errors/src/json.rs
+++ b/compiler/rustc_errors/src/json.rs
@@ -21,7 +21,7 @@ use rustc_error_messages::FluentArgs;
use rustc_lint_defs::Applicability;
use rustc_span::Span;
use rustc_span::hygiene::ExpnData;
-use rustc_span::source_map::SourceMap;
+use rustc_span::source_map::{FilePathMapping, SourceMap};
use serde::Serialize;
use termcolor::{ColorSpec, WriteColor};
@@ -45,7 +45,7 @@ pub struct JsonEmitter {
#[setters(skip)]
dst: IntoDynSyncSend>,
#[setters(skip)]
- sm: Lrc,
+ sm: Option>,
fluent_bundle: Option>,
#[setters(skip)]
fallback_bundle: LazyFallbackBundle,
@@ -65,7 +65,7 @@ pub struct JsonEmitter {
impl JsonEmitter {
pub fn new(
dst: Box,
- sm: Lrc,
+ sm: Option>,
fallback_bundle: LazyFallbackBundle,
pretty: bool,
json_rendered: HumanReadableErrorType,
@@ -171,7 +171,7 @@ impl Emitter for JsonEmitter {
}
fn source_map(&self) -> Option<&SourceMap> {
- Some(&self.sm)
+ self.sm.as_deref()
}
fn should_show_explain(&self) -> bool {
@@ -371,7 +371,7 @@ impl Diagnostic {
}
HumanEmitter::new(dst, Lrc::clone(&je.fallback_bundle))
.short_message(short)
- .sm(Some(Lrc::clone(&je.sm)))
+ .sm(je.sm.clone())
.fluent_bundle(je.fluent_bundle.clone())
.diagnostic_width(je.diagnostic_width)
.macro_backtrace(je.macro_backtrace)
@@ -458,23 +458,34 @@ impl DiagnosticSpan {
mut backtrace: impl Iterator- ,
je: &JsonEmitter,
) -> DiagnosticSpan {
- let start = je.sm.lookup_char_pos(span.lo());
+ let empty_source_map;
+ let sm = match &je.sm {
+ Some(s) => s,
+ None => {
+ span = rustc_span::DUMMY_SP;
+ empty_source_map = Arc::new(SourceMap::new(FilePathMapping::empty()));
+ empty_source_map
+ .new_source_file(std::path::PathBuf::from("empty.rs").into(), String::new());
+ &empty_source_map
+ }
+ };
+ let start = sm.lookup_char_pos(span.lo());
// If this goes from the start of a line to the end and the replacement
// is an empty string, increase the length to include the newline so we don't
// leave an empty line
if start.col.0 == 0
&& let Some((suggestion, _)) = suggestion
&& suggestion.is_empty()
- && let Ok(after) = je.sm.span_to_next_source(span)
+ && let Ok(after) = sm.span_to_next_source(span)
&& after.starts_with('\n')
{
span = span.with_hi(span.hi() + rustc_span::BytePos(1));
}
- let end = je.sm.lookup_char_pos(span.hi());
+ let end = sm.lookup_char_pos(span.hi());
let backtrace_step = backtrace.next().map(|bt| {
let call_site = Self::from_span_full(bt.call_site, false, None, None, backtrace, je);
let def_site_span = Self::from_span_full(
- je.sm.guess_head_span(bt.def_site),
+ sm.guess_head_span(bt.def_site),
false,
None,
None,
@@ -489,7 +500,7 @@ impl DiagnosticSpan {
});
DiagnosticSpan {
- file_name: je.sm.filename_for_diagnostics(&start.file.name).to_string(),
+ file_name: sm.filename_for_diagnostics(&start.file.name).to_string(),
byte_start: start.file.original_relative_byte_pos(span.lo()).0,
byte_end: start.file.original_relative_byte_pos(span.hi()).0,
line_start: start.line,
@@ -559,19 +570,20 @@ impl DiagnosticSpanLine {
/// `span` within the line.
fn from_span(span: Span, je: &JsonEmitter) -> Vec {
je.sm
- .span_to_lines(span)
- .map(|lines| {
+ .as_ref()
+ .and_then(|sm| {
+ let lines = sm.span_to_lines(span).ok()?;
// We can't get any lines if the source is unavailable.
if !should_show_source_code(
&je.ignored_directories_in_source_blocks,
- &je.sm,
+ &sm,
&lines.file,
) {
- return vec![];
+ return None;
}
let sf = &*lines.file;
- lines
+ let span_lines = lines
.lines
.iter()
.map(|line| {
@@ -582,8 +594,9 @@ impl DiagnosticSpanLine {
line.end_col.0 + 1,
)
})
- .collect()
+ .collect();
+ Some(span_lines)
})
- .unwrap_or_else(|_| vec![])
+ .unwrap_or_default()
}
}
diff --git a/compiler/rustc_errors/src/json/tests.rs b/compiler/rustc_errors/src/json/tests.rs
index 0de555b83d3a..cebaf7c1cfe4 100644
--- a/compiler/rustc_errors/src/json/tests.rs
+++ b/compiler/rustc_errors/src/json/tests.rs
@@ -47,7 +47,7 @@ fn test_positions(code: &str, span: (u32, u32), expected_output: SpanTestData) {
let output = Arc::new(Mutex::new(Vec::new()));
let je = JsonEmitter::new(
Box::new(Shared { data: output.clone() }),
- sm,
+ Some(sm),
fallback_bundle,
true, // pretty
HumanReadableErrorType::Short,
diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs
index 68e0191f45e7..17433eed9e76 100644
--- a/compiler/rustc_feature/src/builtin_attrs.rs
+++ b/compiler/rustc_feature/src/builtin_attrs.rs
@@ -408,11 +408,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
crate_type, CrateLevel, template!(NameValueStr: "bin|lib|..."), DuplicatesOk,
EncodeCrossCrate::No,
),
- // crate_id is deprecated
- ungated!(
- crate_id, CrateLevel, template!(NameValueStr: "ignored"), FutureWarnFollowing,
- EncodeCrossCrate::No,
- ),
// ABI, linking, symbols, and FFI
ungated!(
@@ -448,7 +443,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
),
// Entry point:
- ungated!(no_start, CrateLevel, template!(Word), WarnFollowing, EncodeCrossCrate::No),
ungated!(no_main, CrateLevel, template!(Word), WarnFollowing, EncodeCrossCrate::No),
// Modules, prelude, and resolution:
@@ -532,7 +526,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
),
// RFC 2412
gated!(
- optimize, Normal, template!(List: "size|speed"), ErrorPreceding,
+ optimize, Normal, template!(List: "none|size|speed"), ErrorPreceding,
EncodeCrossCrate::No, optimize_attribute, experimental!(optimize)
),
diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl
index 512d379687bc..be4004f5904c 100644
--- a/compiler/rustc_hir_analysis/messages.ftl
+++ b/compiler/rustc_hir_analysis/messages.ftl
@@ -353,7 +353,13 @@ hir_analysis_missing_type_params =
[one] reference
*[other] references
} to {$parameters}
- .note = because of the default `Self` reference, type parameters must be specified on object types
+ .note = because the parameter {$parameterCount ->
+ [one] default references
+ *[other] defaults reference
+ } `Self`, the {$parameterCount ->
+ [one] parameter
+ *[other] parameters
+ } must be specified on the object type
hir_analysis_multiple_relaxed_default_bounds =
type parameter has more than one relaxed default bound, only one is supported
diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs
index 72ad190df7ee..e59ff02642cf 100644
--- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs
+++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs
@@ -237,16 +237,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
// Skip `Self`
.skip(1)
.map(|(index, arg)| {
- if arg == dummy_self.into() {
+ if arg.walk().any(|arg| arg == dummy_self.into()) {
let param = &generics.own_params[index];
missing_type_params.push(param.name);
Ty::new_misc_error(tcx).into()
- } else if arg.walk().any(|arg| arg == dummy_self.into()) {
- let guar = self.dcx().span_delayed_bug(
- span,
- "trait object trait bounds reference `Self`",
- );
- replace_dummy_self_with_error(tcx, arg, guar)
} else {
arg
}
diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs
index 16294970f053..928010c03c2e 100644
--- a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs
+++ b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs
@@ -185,6 +185,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
rhs_ty: Ty<'tcx>,
can_satisfy: impl FnOnce(Ty<'tcx>, Ty<'tcx>) -> bool,
) -> bool {
+ if lhs_expr.span.in_derive_expansion() || rhs_expr.span.in_derive_expansion() {
+ return false;
+ }
let Some((_, lhs_output_ty, lhs_inputs)) = self.extract_callable_info(lhs_ty) else {
return false;
};
diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl
index 64c8f00cc833..7e64f7f002ff 100644
--- a/compiler/rustc_lint/messages.ftl
+++ b/compiler/rustc_lint/messages.ftl
@@ -69,12 +69,10 @@ lint_builtin_const_no_mangle = const items should never be `#[no_mangle]`
lint_builtin_decl_unsafe_fn = declaration of an `unsafe` function
lint_builtin_decl_unsafe_method = declaration of an `unsafe` method
-lint_builtin_deprecated_attr_default_suggestion = remove this attribute
lint_builtin_deprecated_attr_link = use of deprecated attribute `{$name}`: {$reason}. See {$link}
.msg_suggestion = {$msg}
.default_suggestion = remove this attribute
-lint_builtin_deprecated_attr_used = use of deprecated attribute `{$name}`: no longer used
lint_builtin_deref_nullptr = dereferencing a null pointer
.label = this code causes undefined behavior when executed
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index fb3cf5afad03..876ef944d650 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -20,7 +20,7 @@ use rustc_abi::BackendRepr;
use rustc_ast::tokenstream::{TokenStream, TokenTree};
use rustc_ast::visit::{FnCtxt, FnKind};
use rustc_ast::{self as ast, *};
-use rustc_ast_pretty::pprust::{self, expr_to_string};
+use rustc_ast_pretty::pprust::expr_to_string;
use rustc_errors::{Applicability, LintDiagnostic};
use rustc_feature::{AttributeGate, BuiltinAttribute, GateIssue, Stability, deprecated_attributes};
use rustc_hir as hir;
@@ -49,7 +49,7 @@ use rustc_trait_selection::traits::{self};
use crate::errors::BuiltinEllipsisInclusiveRangePatterns;
use crate::lints::{
BuiltinAnonymousParams, BuiltinConstNoMangle, BuiltinDeprecatedAttrLink,
- BuiltinDeprecatedAttrLinkSuggestion, BuiltinDeprecatedAttrUsed, BuiltinDerefNullptr,
+ BuiltinDeprecatedAttrLinkSuggestion, BuiltinDerefNullptr,
BuiltinEllipsisInclusiveRangePatternsLint, BuiltinExplicitOutlives,
BuiltinExplicitOutlivesSuggestion, BuiltinFeatureIssueNote, BuiltinIncompleteFeatures,
BuiltinIncompleteFeaturesHelp, BuiltinInternalFeatures, BuiltinKeywordIdents,
@@ -848,12 +848,6 @@ impl EarlyLintPass for DeprecatedAttr {
return;
}
}
- if attr.has_name(sym::no_start) || attr.has_name(sym::crate_id) {
- cx.emit_span_lint(DEPRECATED, attr.span, BuiltinDeprecatedAttrUsed {
- name: pprust::path_to_string(&attr.get_normal_item().path),
- suggestion: attr.span,
- });
- }
}
}
diff --git a/compiler/rustc_lint/src/early/diagnostics/check_cfg.rs b/compiler/rustc_lint/src/early/diagnostics/check_cfg.rs
index eebb131599a2..da6dd8161ee5 100644
--- a/compiler/rustc_lint/src/early/diagnostics/check_cfg.rs
+++ b/compiler/rustc_lint/src/early/diagnostics/check_cfg.rs
@@ -10,19 +10,35 @@ use crate::lints;
const MAX_CHECK_CFG_NAMES_OR_VALUES: usize = 35;
+enum FilterWellKnownNames {
+ Yes,
+ No,
+}
+
fn sort_and_truncate_possibilities(
sess: &Session,
mut possibilities: Vec,
+ filter_well_known_names: FilterWellKnownNames,
) -> (Vec, usize) {
+ let possibilities_len = possibilities.len();
+
let n_possibilities = if sess.opts.unstable_opts.check_cfg_all_expected {
possibilities.len()
} else {
+ match filter_well_known_names {
+ FilterWellKnownNames::Yes => {
+ possibilities.retain(|cfg_name| {
+ !sess.psess.check_config.well_known_names.contains(cfg_name)
+ });
+ }
+ FilterWellKnownNames::No => {}
+ };
std::cmp::min(possibilities.len(), MAX_CHECK_CFG_NAMES_OR_VALUES)
};
possibilities.sort_by(|s1, s2| s1.as_str().cmp(s2.as_str()));
- let and_more = possibilities.len().saturating_sub(n_possibilities);
+ let and_more = possibilities_len.saturating_sub(n_possibilities);
possibilities.truncate(n_possibilities);
(possibilities, and_more)
}
@@ -198,8 +214,10 @@ pub(super) fn unexpected_cfg_name(
} else {
vec![]
};
+
+ let (possibilities, and_more) =
+ sort_and_truncate_possibilities(sess, possibilities, FilterWellKnownNames::Yes);
let expected_names = if !possibilities.is_empty() {
- let (possibilities, and_more) = sort_and_truncate_possibilities(sess, possibilities);
let possibilities: Vec<_> =
possibilities.into_iter().map(|s| Ident::new(s, name_span)).collect();
Some(lints::unexpected_cfg_name::ExpectedNames {
@@ -269,8 +287,11 @@ pub(super) fn unexpected_cfg_value(
// for names as the possibilities could be very long
let code_sugg = if !possibilities.is_empty() {
let expected_values = {
- let (possibilities, and_more) =
- sort_and_truncate_possibilities(sess, possibilities.clone());
+ let (possibilities, and_more) = sort_and_truncate_possibilities(
+ sess,
+ possibilities.clone(),
+ FilterWellKnownNames::No,
+ );
lints::unexpected_cfg_value::ExpectedValues {
name,
have_none_possibility,
diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs
index 84a6272198fa..0b7d1f45f2a0 100644
--- a/compiler/rustc_lint/src/lints.rs
+++ b/compiler/rustc_lint/src/lints.rs
@@ -177,19 +177,6 @@ pub(crate) enum BuiltinDeprecatedAttrLinkSuggestion<'a> {
},
}
-#[derive(LintDiagnostic)]
-#[diag(lint_builtin_deprecated_attr_used)]
-pub(crate) struct BuiltinDeprecatedAttrUsed {
- pub name: String,
- #[suggestion(
- lint_builtin_deprecated_attr_default_suggestion,
- style = "short",
- code = "",
- applicability = "machine-applicable"
- )]
- pub suggestion: Span,
-}
-
#[derive(LintDiagnostic)]
#[diag(lint_builtin_unused_doc_comment)]
pub(crate) struct BuiltinUnusedDocComment<'a> {
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
index 9fc527a6a3ab..5cdd18f5ea90 100644
--- a/compiler/rustc_lint_defs/src/builtin.rs
+++ b/compiler/rustc_lint_defs/src/builtin.rs
@@ -60,6 +60,7 @@ declare_lint_pass! {
LARGE_ASSIGNMENTS,
LATE_BOUND_LIFETIME_ARGUMENTS,
LEGACY_DERIVE_HELPERS,
+ LINKER_MESSAGES,
LONG_RUNNING_CONST_EVAL,
LOSSY_PROVENANCE_CASTS,
MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS,
@@ -4085,6 +4086,39 @@ declare_lint! {
"call to foreign functions or function pointers with FFI-unwind ABI"
}
+declare_lint! {
+ /// The `linker_messages` lint forwards warnings from the linker.
+ ///
+ /// ### Example
+ ///
+ /// ```rust,ignore (needs CLI args, platform-specific)
+ /// extern "C" {
+ /// fn foo();
+ /// }
+ /// fn main () { unsafe { foo(); } }
+ /// ```
+ ///
+ /// On Linux, using `gcc -Wl,--warn-unresolved-symbols` as a linker, this will produce
+ ///
+ /// ```text
+ /// warning: linker stderr: rust-lld: undefined symbol: foo
+ /// >>> referenced by rust_out.69edbd30df4ae57d-cgu.0
+ /// >>> rust_out.rust_out.69edbd30df4ae57d-cgu.0.rcgu.o:(rust_out::main::h3a90094b06757803)
+ /// |
+ /// = note: `#[warn(linker_messages)]` on by default
+ ///
+ /// warning: 1 warning emitted
+ /// ```
+ ///
+ /// ### Explanation
+ ///
+ /// Linkers emit platform-specific and program-specific warnings that cannot be predicted in advance by the rust compiler.
+ /// They are forwarded by default, but can be disabled by adding `#![allow(linker_messages)]` at the crate root.
+ pub LINKER_MESSAGES,
+ Warn,
+ "warnings emitted at runtime by the target-specific linker program"
+}
+
declare_lint! {
/// The `named_arguments_used_positionally` lint detects cases where named arguments are only
/// used positionally in format strings. This usage is valid but potentially very confusing.
diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs
index 7786d3eb59af..9f4c5d89d0e9 100644
--- a/compiler/rustc_lint_defs/src/lib.rs
+++ b/compiler/rustc_lint_defs/src/lib.rs
@@ -161,7 +161,19 @@ impl ToStableHashKey for LintExpectation
/// Setting for how to handle a lint.
///
/// See:
-#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash, HashStable_Generic)]
+#[derive(
+ Clone,
+ Copy,
+ PartialEq,
+ PartialOrd,
+ Eq,
+ Ord,
+ Debug,
+ Hash,
+ Encodable,
+ Decodable,
+ HashStable_Generic
+)]
pub enum Level {
/// The `allow` level will not issue any message.
Allow,
diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs
index 620d9f1c3579..cae980cde613 100644
--- a/compiler/rustc_middle/src/lint.rs
+++ b/compiler/rustc_middle/src/lint.rs
@@ -4,7 +4,7 @@ use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::sorted_map::SortedMap;
use rustc_errors::{Diag, MultiSpan};
use rustc_hir::{HirId, ItemLocalId};
-use rustc_macros::HashStable;
+use rustc_macros::{Decodable, Encodable, HashStable};
use rustc_session::Session;
use rustc_session::lint::builtin::{self, FORBIDDEN_LINT_GROUPS};
use rustc_session::lint::{FutureIncompatibilityReason, Level, Lint, LintExpectationId, LintId};
@@ -15,7 +15,7 @@ use tracing::instrument;
use crate::ty::TyCtxt;
/// How a lint level was set.
-#[derive(Clone, Copy, PartialEq, Eq, HashStable, Debug)]
+#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, HashStable, Debug)]
pub enum LintLevelSource {
/// Lint is at the default level as declared in rustc.
Default,
@@ -173,7 +173,7 @@ impl TyCtxt<'_> {
/// This struct represents a lint expectation and holds all required information
/// to emit the `unfulfilled_lint_expectations` lint if it is unfulfilled after
/// the `LateLintPass` has completed.
-#[derive(Clone, Debug, HashStable)]
+#[derive(Clone, Debug, Encodable, Decodable, HashStable)]
pub struct LintExpectation {
/// The reason for this expectation that can optionally be added as part of
/// the attribute. It will be displayed as part of the lint message.
diff --git a/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs b/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs
index e05f42af6fd2..cc980f6e62ae 100644
--- a/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs
+++ b/compiler/rustc_middle/src/middle/codegen_fn_attrs.rs
@@ -147,7 +147,7 @@ impl CodegenFnAttrs {
CodegenFnAttrs {
flags: CodegenFnAttrFlags::empty(),
inline: InlineAttr::None,
- optimize: OptimizeAttr::None,
+ optimize: OptimizeAttr::Default,
export_name: None,
link_name: None,
link_ordinal: None,
diff --git a/compiler/rustc_mir_build/messages.ftl b/compiler/rustc_mir_build/messages.ftl
index ffdb721fb18b..053775b49378 100644
--- a/compiler/rustc_mir_build/messages.ftl
+++ b/compiler/rustc_mir_build/messages.ftl
@@ -25,6 +25,8 @@ mir_build_borrow_of_moved_value = borrow of moved value
.occurs_because_label = move occurs because `{$name}` has type `{$ty}`, which does not implement the `Copy` trait
.value_borrowed_label = value borrowed here after move
.suggestion = borrow this binding in the pattern to avoid moving the value
+ .full_type_name = the full type name has been written to '{$path}'
+ .consider_verbose = consider using `--verbose` to print the full type name to the console
mir_build_call_to_deprecated_safe_fn_requires_unsafe =
call to deprecated safe function `{$function}` is unsafe and requires unsafe block
diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs
index 83aec9ccdefc..c3bf5868eecd 100644
--- a/compiler/rustc_mir_build/src/errors.rs
+++ b/compiler/rustc_mir_build/src/errors.rs
@@ -790,7 +790,7 @@ pub(crate) struct IrrefutableLetPatternsWhileLet {
#[derive(Diagnostic)]
#[diag(mir_build_borrow_of_moved_value)]
-pub(crate) struct BorrowOfMovedValue<'tcx> {
+pub(crate) struct BorrowOfMovedValue {
#[primary_span]
#[label]
#[label(mir_build_occurs_because_label)]
@@ -798,9 +798,13 @@ pub(crate) struct BorrowOfMovedValue<'tcx> {
#[label(mir_build_value_borrowed_label)]
pub(crate) conflicts_ref: Vec,
pub(crate) name: Symbol,
- pub(crate) ty: Ty<'tcx>,
+ pub(crate) ty: String,
#[suggestion(code = "ref ", applicability = "machine-applicable")]
pub(crate) suggest_borrowing: Option,
+ #[note(mir_build_full_type_name)]
+ #[note(mir_build_consider_verbose)]
+ pub(crate) has_path: bool,
+ pub(crate) path: String,
}
#[derive(Diagnostic)]
diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs
index b5b7b54a1cc3..d8b04398d9a5 100644
--- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs
+++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs
@@ -795,12 +795,16 @@ fn check_borrow_conflicts_in_at_patterns<'tcx>(cx: &MatchVisitor<'_, 'tcx>, pat:
}
});
if !conflicts_ref.is_empty() {
+ let mut path = None;
+ let ty = cx.tcx.short_ty_string(ty, &mut path);
sess.dcx().emit_err(BorrowOfMovedValue {
binding_span: pat.span,
conflicts_ref,
name,
ty,
suggest_borrowing: Some(pat.span.shrink_to_lo()),
+ has_path: path.is_some(),
+ path: path.map(|p| p.display().to_string()).unwrap_or_default(),
});
}
return;
diff --git a/compiler/rustc_mir_transform/src/abort_unwinding_calls.rs b/compiler/rustc_mir_transform/src/abort_unwinding_calls.rs
index 03f11885d58a..5bd6fdcf4857 100644
--- a/compiler/rustc_mir_transform/src/abort_unwinding_calls.rs
+++ b/compiler/rustc_mir_transform/src/abort_unwinding_calls.rs
@@ -116,4 +116,8 @@ impl<'tcx> crate::MirPass<'tcx> for AbortUnwindingCalls {
// We may have invalidated some `cleanup` blocks so clean those up now.
super::simplify::remove_dead_blocks(body);
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
diff --git a/compiler/rustc_mir_transform/src/add_call_guards.rs b/compiler/rustc_mir_transform/src/add_call_guards.rs
index 24c955c0c78c..55694cacd92e 100644
--- a/compiler/rustc_mir_transform/src/add_call_guards.rs
+++ b/compiler/rustc_mir_transform/src/add_call_guards.rs
@@ -75,4 +75,8 @@ impl<'tcx> crate::MirPass<'tcx> for AddCallGuards {
body.basic_blocks_mut().extend(new_blocks);
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
diff --git a/compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs b/compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs
index 12a2fe23b149..87ae2b716543 100644
--- a/compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs
+++ b/compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs
@@ -68,6 +68,10 @@ impl<'tcx> crate::MirPass<'tcx> for AddMovesForPackedDrops {
patch.apply(body);
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
fn add_move_for_packed_drop<'tcx>(
diff --git a/compiler/rustc_mir_transform/src/add_retag.rs b/compiler/rustc_mir_transform/src/add_retag.rs
index 53176eec9bcb..1fc788a2dade 100644
--- a/compiler/rustc_mir_transform/src/add_retag.rs
+++ b/compiler/rustc_mir_transform/src/add_retag.rs
@@ -176,4 +176,8 @@ impl<'tcx> crate::MirPass<'tcx> for AddRetag {
}
}
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
diff --git a/compiler/rustc_mir_transform/src/add_subtyping_projections.rs b/compiler/rustc_mir_transform/src/add_subtyping_projections.rs
index e585e338613d..e41f47db545b 100644
--- a/compiler/rustc_mir_transform/src/add_subtyping_projections.rs
+++ b/compiler/rustc_mir_transform/src/add_subtyping_projections.rs
@@ -61,4 +61,8 @@ impl<'tcx> crate::MirPass<'tcx> for Subtyper {
}
checker.patcher.apply(body);
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
diff --git a/compiler/rustc_mir_transform/src/check_alignment.rs b/compiler/rustc_mir_transform/src/check_alignment.rs
index 1b7c89fd2518..d7e22c123942 100644
--- a/compiler/rustc_mir_transform/src/check_alignment.rs
+++ b/compiler/rustc_mir_transform/src/check_alignment.rs
@@ -60,6 +60,10 @@ impl<'tcx> crate::MirPass<'tcx> for CheckAlignment {
}
}
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
struct PointerFinder<'a, 'tcx> {
diff --git a/compiler/rustc_mir_transform/src/cleanup_post_borrowck.rs b/compiler/rustc_mir_transform/src/cleanup_post_borrowck.rs
index 6a22a58470c9..cb8440198573 100644
--- a/compiler/rustc_mir_transform/src/cleanup_post_borrowck.rs
+++ b/compiler/rustc_mir_transform/src/cleanup_post_borrowck.rs
@@ -72,4 +72,8 @@ impl<'tcx> crate::MirPass<'tcx> for CleanupPostBorrowck {
decl.user_ty = None;
}
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
diff --git a/compiler/rustc_mir_transform/src/copy_prop.rs b/compiler/rustc_mir_transform/src/copy_prop.rs
index f149bf97cde6..27af5818982d 100644
--- a/compiler/rustc_mir_transform/src/copy_prop.rs
+++ b/compiler/rustc_mir_transform/src/copy_prop.rs
@@ -56,6 +56,10 @@ impl<'tcx> crate::MirPass<'tcx> for CopyProp {
crate::simplify::remove_unused_definitions(body);
}
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
/// `SsaLocals` computed equivalence classes between locals considering copy/move assignments.
diff --git a/compiler/rustc_mir_transform/src/coroutine.rs b/compiler/rustc_mir_transform/src/coroutine.rs
index a3715b5d4855..3b75be58e437 100644
--- a/compiler/rustc_mir_transform/src/coroutine.rs
+++ b/compiler/rustc_mir_transform/src/coroutine.rs
@@ -1688,6 +1688,10 @@ impl<'tcx> crate::MirPass<'tcx> for StateTransform {
// Run derefer to fix Derefs that are not in the first place
deref_finder(tcx, body);
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
/// Looks for any assignments between locals (e.g., `_4 = _5`) that will both be converted to fields
diff --git a/compiler/rustc_mir_transform/src/coverage/mod.rs b/compiler/rustc_mir_transform/src/coverage/mod.rs
index b8aa76a7dbe5..15487d05a301 100644
--- a/compiler/rustc_mir_transform/src/coverage/mod.rs
+++ b/compiler/rustc_mir_transform/src/coverage/mod.rs
@@ -61,6 +61,10 @@ impl<'tcx> crate::MirPass<'tcx> for InstrumentCoverage {
instrument_function_for_coverage(tcx, mir_body);
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
fn instrument_function_for_coverage<'tcx>(tcx: TyCtxt<'tcx>, mir_body: &mut mir::Body<'tcx>) {
diff --git a/compiler/rustc_mir_transform/src/cross_crate_inline.rs b/compiler/rustc_mir_transform/src/cross_crate_inline.rs
index 8fce856687cb..4f45d9588a89 100644
--- a/compiler/rustc_mir_transform/src/cross_crate_inline.rs
+++ b/compiler/rustc_mir_transform/src/cross_crate_inline.rs
@@ -69,7 +69,7 @@ fn cross_crate_inlinable(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
// Don't do any inference if codegen optimizations are disabled and also MIR inlining is not
// enabled. This ensures that we do inference even if someone only passes -Zinline-mir,
// which is less confusing than having to also enable -Copt-level=1.
- let inliner_will_run = pm::should_run_pass(tcx, &inline::Inline)
+ let inliner_will_run = pm::should_run_pass(tcx, &inline::Inline, pm::Optimizations::Allowed)
|| inline::ForceInline::should_run_pass_for_callee(tcx, def_id.to_def_id());
if matches!(tcx.sess.opts.optimize, OptLevel::No) && !inliner_will_run {
return false;
diff --git a/compiler/rustc_mir_transform/src/ctfe_limit.rs b/compiler/rustc_mir_transform/src/ctfe_limit.rs
index bd58b1b66899..d0b313e149ac 100644
--- a/compiler/rustc_mir_transform/src/ctfe_limit.rs
+++ b/compiler/rustc_mir_transform/src/ctfe_limit.rs
@@ -36,6 +36,10 @@ impl<'tcx> crate::MirPass<'tcx> for CtfeLimit {
);
}
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
fn has_back_edge(
diff --git a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs
index 51af77778af8..8879e029346d 100644
--- a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs
+++ b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs
@@ -71,6 +71,10 @@ impl<'tcx> crate::MirPass<'tcx> for DataflowConstProp {
let mut patch = visitor.patch;
debug_span!("patch").in_scope(|| patch.visit_body_preserves_cfg(body));
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
// Note: Currently, places that have their reference taken cannot be tracked. Although this would
diff --git a/compiler/rustc_mir_transform/src/dead_store_elimination.rs b/compiler/rustc_mir_transform/src/dead_store_elimination.rs
index 434e921d4392..eea2b0990d73 100644
--- a/compiler/rustc_mir_transform/src/dead_store_elimination.rs
+++ b/compiler/rustc_mir_transform/src/dead_store_elimination.rs
@@ -147,4 +147,8 @@ impl<'tcx> crate::MirPass<'tcx> for DeadStoreElimination {
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
eliminate(tcx, body);
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
diff --git a/compiler/rustc_mir_transform/src/deduplicate_blocks.rs b/compiler/rustc_mir_transform/src/deduplicate_blocks.rs
index 26b28c8c4870..63257df66fb9 100644
--- a/compiler/rustc_mir_transform/src/deduplicate_blocks.rs
+++ b/compiler/rustc_mir_transform/src/deduplicate_blocks.rs
@@ -31,6 +31,10 @@ impl<'tcx> crate::MirPass<'tcx> for DeduplicateBlocks {
simplify_cfg(body);
}
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
struct OptApplier<'tcx> {
diff --git a/compiler/rustc_mir_transform/src/deref_separator.rs b/compiler/rustc_mir_transform/src/deref_separator.rs
index ad7ccef4976a..a54bdaa40759 100644
--- a/compiler/rustc_mir_transform/src/deref_separator.rs
+++ b/compiler/rustc_mir_transform/src/deref_separator.rs
@@ -81,4 +81,8 @@ impl<'tcx> crate::MirPass<'tcx> for Derefer {
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
deref_finder(tcx, body);
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
diff --git a/compiler/rustc_mir_transform/src/dest_prop.rs b/compiler/rustc_mir_transform/src/dest_prop.rs
index b4f9f1f08ef8..41de1b58b91b 100644
--- a/compiler/rustc_mir_transform/src/dest_prop.rs
+++ b/compiler/rustc_mir_transform/src/dest_prop.rs
@@ -240,6 +240,10 @@ impl<'tcx> crate::MirPass<'tcx> for DestinationPropagation {
trace!(round_count);
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
#[derive(Debug, Default)]
diff --git a/compiler/rustc_mir_transform/src/dump_mir.rs b/compiler/rustc_mir_transform/src/dump_mir.rs
index 5dd84975b88e..e4fcbaa483d0 100644
--- a/compiler/rustc_mir_transform/src/dump_mir.rs
+++ b/compiler/rustc_mir_transform/src/dump_mir.rs
@@ -15,6 +15,10 @@ impl<'tcx> crate::MirPass<'tcx> for Marker {
}
fn run_pass(&self, _tcx: TyCtxt<'tcx>, _body: &mut Body<'tcx>) {}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
pub fn emit_mir(tcx: TyCtxt<'_>) -> io::Result<()> {
diff --git a/compiler/rustc_mir_transform/src/early_otherwise_branch.rs b/compiler/rustc_mir_transform/src/early_otherwise_branch.rs
index 91e1395e7641..eb335a1e4a70 100644
--- a/compiler/rustc_mir_transform/src/early_otherwise_branch.rs
+++ b/compiler/rustc_mir_transform/src/early_otherwise_branch.rs
@@ -227,6 +227,10 @@ impl<'tcx> crate::MirPass<'tcx> for EarlyOtherwiseBranch {
simplify_cfg(body);
}
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
#[derive(Debug)]
diff --git a/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs b/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs
index d6ecadbfe29c..6d3b5d9851b3 100644
--- a/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs
+++ b/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs
@@ -150,4 +150,8 @@ impl<'tcx> crate::MirPass<'tcx> for ElaborateBoxDerefs {
}
}
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
diff --git a/compiler/rustc_mir_transform/src/elaborate_drops.rs b/compiler/rustc_mir_transform/src/elaborate_drops.rs
index 988f1a25561e..cb869160c805 100644
--- a/compiler/rustc_mir_transform/src/elaborate_drops.rs
+++ b/compiler/rustc_mir_transform/src/elaborate_drops.rs
@@ -88,6 +88,10 @@ impl<'tcx> crate::MirPass<'tcx> for ElaborateDrops {
elaborate_patch.apply(body);
deref_finder(tcx, body);
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
/// Records unwind edges which are known to be unreachable, because they are in `drop` terminators
diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs
index cb03b422d9e3..dfeb83a0887d 100644
--- a/compiler/rustc_mir_transform/src/gvn.rs
+++ b/compiler/rustc_mir_transform/src/gvn.rs
@@ -163,6 +163,10 @@ impl<'tcx> crate::MirPass<'tcx> for GVN {
// statements.
StorageRemover { tcx, reused_locals: state.reused_locals }.visit_body_preserves_cfg(body);
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
newtype_index! {
diff --git a/compiler/rustc_mir_transform/src/impossible_predicates.rs b/compiler/rustc_mir_transform/src/impossible_predicates.rs
index ba8389bbe2ff..86e2bf6cb3c6 100644
--- a/compiler/rustc_mir_transform/src/impossible_predicates.rs
+++ b/compiler/rustc_mir_transform/src/impossible_predicates.rs
@@ -53,4 +53,8 @@ impl<'tcx> MirPass<'tcx> for ImpossiblePredicates {
body.local_decls.raw.truncate(body.arg_count + 1);
}
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs
index 2052e28325c9..95aeccfdda66 100644
--- a/compiler/rustc_mir_transform/src/inline.rs
+++ b/compiler/rustc_mir_transform/src/inline.rs
@@ -66,6 +66,10 @@ impl<'tcx> crate::MirPass<'tcx> for Inline {
deref_finder(tcx, body);
}
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
pub struct ForceInline;
@@ -85,6 +89,10 @@ impl<'tcx> crate::MirPass<'tcx> for ForceInline {
false
}
+ fn is_required(&self) -> bool {
+ true
+ }
+
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
let span = trace_span!("force_inline", body = %tcx.def_path_str(body.source.def_id()));
let _guard = span.enter();
diff --git a/compiler/rustc_mir_transform/src/instsimplify.rs b/compiler/rustc_mir_transform/src/instsimplify.rs
index 5a36519e6a3b..090dcee42614 100644
--- a/compiler/rustc_mir_transform/src/instsimplify.rs
+++ b/compiler/rustc_mir_transform/src/instsimplify.rs
@@ -62,6 +62,10 @@ impl<'tcx> crate::MirPass<'tcx> for InstSimplify {
simplify_duplicate_switch_targets(block.terminator.as_mut().unwrap());
}
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
struct InstSimplifyContext<'a, 'tcx> {
diff --git a/compiler/rustc_mir_transform/src/jump_threading.rs b/compiler/rustc_mir_transform/src/jump_threading.rs
index c73a03489c57..17084eca6e38 100644
--- a/compiler/rustc_mir_transform/src/jump_threading.rs
+++ b/compiler/rustc_mir_transform/src/jump_threading.rs
@@ -105,6 +105,10 @@ impl<'tcx> crate::MirPass<'tcx> for JumpThreading {
}
OpportunitySet::new(body, opportunities).apply(body);
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
#[derive(Debug)]
diff --git a/compiler/rustc_mir_transform/src/large_enums.rs b/compiler/rustc_mir_transform/src/large_enums.rs
index 490e7dd8f7e0..e201763468b3 100644
--- a/compiler/rustc_mir_transform/src/large_enums.rs
+++ b/compiler/rustc_mir_transform/src/large_enums.rs
@@ -200,6 +200,10 @@ impl<'tcx> crate::MirPass<'tcx> for EnumSizeOpt {
});
}
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
impl EnumSizeOpt {
diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs
index d1bacf1f5985..2dc55e3614e6 100644
--- a/compiler/rustc_mir_transform/src/lib.rs
+++ b/compiler/rustc_mir_transform/src/lib.rs
@@ -388,6 +388,7 @@ fn mir_built(tcx: TyCtxt<'_>, def: LocalDefId) -> &Steal> {
&Lint(sanity_check::SanityCheck),
],
None,
+ pm::Optimizations::Allowed,
);
tcx.alloc_steal_mir(body)
}
@@ -440,6 +441,7 @@ fn mir_promoted(
&mut body,
&[&promote_pass, &simplify::SimplifyCfg::PromoteConsts, &coverage::InstrumentCoverage],
Some(MirPhase::Analysis(AnalysisPhase::Initial)),
+ pm::Optimizations::Allowed,
);
lint_tail_expr_drop_order::run_lint(tcx, def, &body);
@@ -473,7 +475,7 @@ fn inner_mir_for_ctfe(tcx: TyCtxt<'_>, def: LocalDefId) -> Body<'_> {
};
let mut body = remap_mir_for_const_eval_select(tcx, body, hir::Constness::Const);
- pm::run_passes(tcx, &mut body, &[&ctfe_limit::CtfeLimit], None);
+ pm::run_passes(tcx, &mut body, &[&ctfe_limit::CtfeLimit], None, pm::Optimizations::Allowed);
body
}
@@ -493,7 +495,7 @@ fn mir_drops_elaborated_and_const_checked(tcx: TyCtxt<'_>, def: LocalDefId) -> &
let is_fn_like = tcx.def_kind(def).is_fn_like();
if is_fn_like {
// Do not compute the mir call graph without said call graph actually being used.
- if pm::should_run_pass(tcx, &inline::Inline)
+ if pm::should_run_pass(tcx, &inline::Inline, pm::Optimizations::Allowed)
|| inline::ForceInline::should_run_pass_for_callee(tcx, def.to_def_id())
{
tcx.ensure_with_value().mir_inliner_callees(ty::InstanceKind::Item(def.to_def_id()));
@@ -533,6 +535,7 @@ pub fn run_analysis_to_runtime_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'
&Lint(post_drop_elaboration::CheckLiveDrops),
],
None,
+ pm::Optimizations::Allowed,
);
}
@@ -557,7 +560,13 @@ fn run_analysis_cleanup_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
&deref_separator::Derefer,
];
- pm::run_passes(tcx, body, passes, Some(MirPhase::Analysis(AnalysisPhase::PostCleanup)));
+ pm::run_passes(
+ tcx,
+ body,
+ passes,
+ Some(MirPhase::Analysis(AnalysisPhase::PostCleanup)),
+ pm::Optimizations::Allowed,
+ );
}
/// Returns the sequence of passes that lowers analysis to runtime MIR.
@@ -597,7 +606,13 @@ fn run_runtime_cleanup_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
&simplify::SimplifyCfg::PreOptimizations,
];
- pm::run_passes(tcx, body, passes, Some(MirPhase::Runtime(RuntimePhase::PostCleanup)));
+ pm::run_passes(
+ tcx,
+ body,
+ passes,
+ Some(MirPhase::Runtime(RuntimePhase::PostCleanup)),
+ pm::Optimizations::Allowed,
+ );
// Clear this by anticipation. Optimizations and runtime MIR have no reason to look
// into this information, which is meant for borrowck diagnostics.
@@ -611,6 +626,15 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
WithMinOptLevel(1, x)
}
+ let def_id = body.source.def_id();
+ let optimizations = if tcx.def_kind(def_id).has_codegen_attrs()
+ && tcx.codegen_fn_attrs(def_id).optimize.do_not_optimize()
+ {
+ pm::Optimizations::Suppressed
+ } else {
+ pm::Optimizations::Allowed
+ };
+
// The main optimizations that we do on MIR.
pm::run_passes(
tcx,
@@ -683,6 +707,7 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
&dump_mir::Marker("PreCodegen"),
],
Some(MirPhase::Runtime(RuntimePhase::Optimized)),
+ optimizations,
);
}
diff --git a/compiler/rustc_mir_transform/src/lower_intrinsics.rs b/compiler/rustc_mir_transform/src/lower_intrinsics.rs
index 942c6144ea69..9a9f66ed4fd7 100644
--- a/compiler/rustc_mir_transform/src/lower_intrinsics.rs
+++ b/compiler/rustc_mir_transform/src/lower_intrinsics.rs
@@ -325,4 +325,8 @@ impl<'tcx> crate::MirPass<'tcx> for LowerIntrinsics {
}
}
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
diff --git a/compiler/rustc_mir_transform/src/lower_slice_len.rs b/compiler/rustc_mir_transform/src/lower_slice_len.rs
index 420661f29c8c..aca80e36e339 100644
--- a/compiler/rustc_mir_transform/src/lower_slice_len.rs
+++ b/compiler/rustc_mir_transform/src/lower_slice_len.rs
@@ -26,6 +26,10 @@ impl<'tcx> crate::MirPass<'tcx> for LowerSliceLenCalls {
lower_slice_len_call(block, slice_len_fn_item_def_id);
}
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
fn lower_slice_len_call<'tcx>(block: &mut BasicBlockData<'tcx>, slice_len_fn_item_def_id: DefId) {
diff --git a/compiler/rustc_mir_transform/src/match_branches.rs b/compiler/rustc_mir_transform/src/match_branches.rs
index 534ba9917801..500116580d5d 100644
--- a/compiler/rustc_mir_transform/src/match_branches.rs
+++ b/compiler/rustc_mir_transform/src/match_branches.rs
@@ -49,6 +49,10 @@ impl<'tcx> crate::MirPass<'tcx> for MatchBranchSimplification {
simplify_cfg(body);
}
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
trait SimplifyMatch<'tcx> {
diff --git a/compiler/rustc_mir_transform/src/mentioned_items.rs b/compiler/rustc_mir_transform/src/mentioned_items.rs
index cf5c5f85a9ff..f5c57418467a 100644
--- a/compiler/rustc_mir_transform/src/mentioned_items.rs
+++ b/compiler/rustc_mir_transform/src/mentioned_items.rs
@@ -27,6 +27,10 @@ impl<'tcx> crate::MirPass<'tcx> for MentionedItems {
visitor.visit_body(body);
body.set_mentioned_items(visitor.mentioned_items);
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
// This visitor is carefully in sync with the one in `rustc_monomorphize::collector`. We are
diff --git a/compiler/rustc_mir_transform/src/multiple_return_terminators.rs b/compiler/rustc_mir_transform/src/multiple_return_terminators.rs
index 6dfa14d6b527..c63bfdcee855 100644
--- a/compiler/rustc_mir_transform/src/multiple_return_terminators.rs
+++ b/compiler/rustc_mir_transform/src/multiple_return_terminators.rs
@@ -36,4 +36,8 @@ impl<'tcx> crate::MirPass<'tcx> for MultipleReturnTerminators {
simplify::remove_dead_blocks(body)
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
diff --git a/compiler/rustc_mir_transform/src/nrvo.rs b/compiler/rustc_mir_transform/src/nrvo.rs
index 35872de38524..965002aae04c 100644
--- a/compiler/rustc_mir_transform/src/nrvo.rs
+++ b/compiler/rustc_mir_transform/src/nrvo.rs
@@ -71,6 +71,10 @@ impl<'tcx> crate::MirPass<'tcx> for RenameReturnPlace {
// The return place is always mutable.
ret_decl.mutability = Mutability::Mut;
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
/// MIR that is eligible for the NRVO must fulfill two conditions:
diff --git a/compiler/rustc_mir_transform/src/pass_manager.rs b/compiler/rustc_mir_transform/src/pass_manager.rs
index c3f0a989ce10..7a8d3ba1ff1f 100644
--- a/compiler/rustc_mir_transform/src/pass_manager.rs
+++ b/compiler/rustc_mir_transform/src/pass_manager.rs
@@ -90,6 +90,11 @@ pub(super) trait MirPass<'tcx> {
fn is_mir_dump_enabled(&self) -> bool {
true
}
+
+ /// Returns `true` if this pass must be run (i.e. it is required for soundness).
+ /// For passes which are strictly optimizations, this should return `false`.
+ /// If this is `false`, `#[optimize(none)]` will disable the pass.
+ fn is_required(&self) -> bool;
}
/// Just like `MirPass`, except it cannot mutate `Body`, and MIR dumping is
@@ -134,6 +139,10 @@ where
fn is_mir_dump_enabled(&self) -> bool {
false
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
pub(super) struct WithMinOptLevel(pub u32, pub T);
@@ -153,6 +162,19 @@ where
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
self.1.run_pass(tcx, body)
}
+
+ fn is_required(&self) -> bool {
+ self.1.is_required()
+ }
+}
+
+/// Whether to allow non-[required] optimizations
+///
+/// [required]: MirPass::is_required
+#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+pub(crate) enum Optimizations {
+ Suppressed,
+ Allowed,
}
/// Run the sequence of passes without validating the MIR after each pass. The MIR is still
@@ -163,7 +185,7 @@ pub(super) fn run_passes_no_validate<'tcx>(
passes: &[&dyn MirPass<'tcx>],
phase_change: Option,
) {
- run_passes_inner(tcx, body, passes, phase_change, false);
+ run_passes_inner(tcx, body, passes, phase_change, false, Optimizations::Allowed);
}
/// The optional `phase_change` is applied after executing all the passes, if present
@@ -172,11 +194,16 @@ pub(super) fn run_passes<'tcx>(
body: &mut Body<'tcx>,
passes: &[&dyn MirPass<'tcx>],
phase_change: Option,
+ optimizations: Optimizations,
) {
- run_passes_inner(tcx, body, passes, phase_change, true);
+ run_passes_inner(tcx, body, passes, phase_change, true, optimizations);
}
-pub(super) fn should_run_pass<'tcx, P>(tcx: TyCtxt<'tcx>, pass: &P) -> bool
+pub(super) fn should_run_pass<'tcx, P>(
+ tcx: TyCtxt<'tcx>,
+ pass: &P,
+ optimizations: Optimizations,
+) -> bool
where
P: MirPass<'tcx> + ?Sized,
{
@@ -196,7 +223,8 @@ where
);
*polarity
});
- overridden.unwrap_or_else(|| pass.is_enabled(tcx.sess))
+ let suppressed = !pass.is_required() && matches!(optimizations, Optimizations::Suppressed);
+ overridden.unwrap_or_else(|| !suppressed && pass.is_enabled(tcx.sess))
}
fn run_passes_inner<'tcx>(
@@ -205,6 +233,7 @@ fn run_passes_inner<'tcx>(
passes: &[&dyn MirPass<'tcx>],
phase_change: Option,
validate_each: bool,
+ optimizations: Optimizations,
) {
let overridden_passes = &tcx.sess.opts.unstable_opts.mir_enable_passes;
trace!(?overridden_passes);
@@ -243,7 +272,7 @@ fn run_passes_inner<'tcx>(
for pass in passes {
let name = pass.name();
- if !should_run_pass(tcx, *pass) {
+ if !should_run_pass(tcx, *pass, optimizations) {
continue;
};
diff --git a/compiler/rustc_mir_transform/src/post_analysis_normalize.rs b/compiler/rustc_mir_transform/src/post_analysis_normalize.rs
index 3eecf79a7eae..76c2f082c0bf 100644
--- a/compiler/rustc_mir_transform/src/post_analysis_normalize.rs
+++ b/compiler/rustc_mir_transform/src/post_analysis_normalize.rs
@@ -15,6 +15,10 @@ impl<'tcx> crate::MirPass<'tcx> for PostAnalysisNormalize {
let typing_env = ty::TypingEnv::post_analysis(tcx, body.source.def_id());
PostAnalysisNormalizeVisitor { tcx, typing_env }.visit_body_preserves_cfg(body);
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
struct PostAnalysisNormalizeVisitor<'tcx> {
diff --git a/compiler/rustc_mir_transform/src/prettify.rs b/compiler/rustc_mir_transform/src/prettify.rs
index 51abd4da86eb..8ccfbe2f194b 100644
--- a/compiler/rustc_mir_transform/src/prettify.rs
+++ b/compiler/rustc_mir_transform/src/prettify.rs
@@ -35,6 +35,10 @@ impl<'tcx> crate::MirPass<'tcx> for ReorderBasicBlocks {
permute(body.basic_blocks.as_mut(), &updater.map);
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
/// Rearranges the locals into *use* order.
@@ -85,6 +89,10 @@ impl<'tcx> crate::MirPass<'tcx> for ReorderLocals {
permute(&mut body.local_decls, &updater.map);
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
fn permute(data: &mut IndexVec, map: &IndexSlice) {
diff --git a/compiler/rustc_mir_transform/src/promote_consts.rs b/compiler/rustc_mir_transform/src/promote_consts.rs
index 6be95b1f0f1e..6aa3343bb6e3 100644
--- a/compiler/rustc_mir_transform/src/promote_consts.rs
+++ b/compiler/rustc_mir_transform/src/promote_consts.rs
@@ -61,6 +61,10 @@ impl<'tcx> crate::MirPass<'tcx> for PromoteTemps<'tcx> {
let promoted = promote_candidates(body, tcx, temps, promotable_candidates);
self.promoted_fragments.set(promoted);
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
/// State of a temporary during collection and promotion.
diff --git a/compiler/rustc_mir_transform/src/ref_prop.rs b/compiler/rustc_mir_transform/src/ref_prop.rs
index 95b05f94270a..368d5340ac34 100644
--- a/compiler/rustc_mir_transform/src/ref_prop.rs
+++ b/compiler/rustc_mir_transform/src/ref_prop.rs
@@ -81,6 +81,10 @@ impl<'tcx> crate::MirPass<'tcx> for ReferencePropagation {
debug!(def_id = ?body.source.def_id());
while propagate_ssa(tcx, body) {}
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
fn propagate_ssa<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) -> bool {
diff --git a/compiler/rustc_mir_transform/src/remove_noop_landing_pads.rs b/compiler/rustc_mir_transform/src/remove_noop_landing_pads.rs
index 76a3edfe0be4..9cdd52bec7bb 100644
--- a/compiler/rustc_mir_transform/src/remove_noop_landing_pads.rs
+++ b/compiler/rustc_mir_transform/src/remove_noop_landing_pads.rs
@@ -74,6 +74,10 @@ impl<'tcx> crate::MirPass<'tcx> for RemoveNoopLandingPads {
debug!("removed {:?} jumps and {:?} landing pads", jumps_folded, landing_pads_removed);
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
impl RemoveNoopLandingPads {
diff --git a/compiler/rustc_mir_transform/src/remove_place_mention.rs b/compiler/rustc_mir_transform/src/remove_place_mention.rs
index 71399eb72f00..15fe77d53195 100644
--- a/compiler/rustc_mir_transform/src/remove_place_mention.rs
+++ b/compiler/rustc_mir_transform/src/remove_place_mention.rs
@@ -20,4 +20,8 @@ impl<'tcx> crate::MirPass<'tcx> for RemovePlaceMention {
})
}
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
diff --git a/compiler/rustc_mir_transform/src/remove_storage_markers.rs b/compiler/rustc_mir_transform/src/remove_storage_markers.rs
index 3ecb4a8994f5..1ae33c009687 100644
--- a/compiler/rustc_mir_transform/src/remove_storage_markers.rs
+++ b/compiler/rustc_mir_transform/src/remove_storage_markers.rs
@@ -22,4 +22,8 @@ impl<'tcx> crate::MirPass<'tcx> for RemoveStorageMarkers {
})
}
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
diff --git a/compiler/rustc_mir_transform/src/remove_uninit_drops.rs b/compiler/rustc_mir_transform/src/remove_uninit_drops.rs
index e955d8277a45..9044a88295cc 100644
--- a/compiler/rustc_mir_transform/src/remove_uninit_drops.rs
+++ b/compiler/rustc_mir_transform/src/remove_uninit_drops.rs
@@ -62,6 +62,10 @@ impl<'tcx> crate::MirPass<'tcx> for RemoveUninitDrops {
block.terminator_mut().kind = TerminatorKind::Goto { target: *target };
}
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
fn is_needs_drop_and_init<'tcx>(
diff --git a/compiler/rustc_mir_transform/src/remove_unneeded_drops.rs b/compiler/rustc_mir_transform/src/remove_unneeded_drops.rs
index e335051d6564..8a8cdafc6907 100644
--- a/compiler/rustc_mir_transform/src/remove_unneeded_drops.rs
+++ b/compiler/rustc_mir_transform/src/remove_unneeded_drops.rs
@@ -38,4 +38,8 @@ impl<'tcx> crate::MirPass<'tcx> for RemoveUnneededDrops {
simplify_cfg(body);
}
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
diff --git a/compiler/rustc_mir_transform/src/remove_zsts.rs b/compiler/rustc_mir_transform/src/remove_zsts.rs
index 55e5701bd0af..78d94a038671 100644
--- a/compiler/rustc_mir_transform/src/remove_zsts.rs
+++ b/compiler/rustc_mir_transform/src/remove_zsts.rs
@@ -27,6 +27,10 @@ impl<'tcx> crate::MirPass<'tcx> for RemoveZsts {
replacer.visit_basic_block_data(bb, data);
}
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
struct Replacer<'a, 'tcx> {
diff --git a/compiler/rustc_mir_transform/src/shim.rs b/compiler/rustc_mir_transform/src/shim.rs
index 4648ec33c934..f7ec0f740d30 100644
--- a/compiler/rustc_mir_transform/src/shim.rs
+++ b/compiler/rustc_mir_transform/src/shim.rs
@@ -119,6 +119,7 @@ fn make_shim<'tcx>(tcx: TyCtxt<'tcx>, instance: ty::InstanceKind<'tcx>) -> Body<
&add_call_guards::CriticalCallEdges,
],
Some(MirPhase::Runtime(RuntimePhase::Optimized)),
+ pm::Optimizations::Allowed,
);
return body;
diff --git a/compiler/rustc_mir_transform/src/simplify.rs b/compiler/rustc_mir_transform/src/simplify.rs
index 4f312ed2aaab..67070f03dedb 100644
--- a/compiler/rustc_mir_transform/src/simplify.rs
+++ b/compiler/rustc_mir_transform/src/simplify.rs
@@ -83,6 +83,10 @@ impl<'tcx> crate::MirPass<'tcx> for SimplifyCfg {
debug!("SimplifyCfg({:?}) - simplifying {:?}", self.name(), body.source);
simplify_cfg(body);
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
struct CfgSimplifier<'a, 'tcx> {
@@ -405,6 +409,10 @@ impl<'tcx> crate::MirPass<'tcx> for SimplifyLocals {
body.local_decls.shrink_to_fit();
}
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
pub(super) fn remove_unused_definitions<'tcx>(body: &mut Body<'tcx>) {
diff --git a/compiler/rustc_mir_transform/src/simplify_branches.rs b/compiler/rustc_mir_transform/src/simplify_branches.rs
index bea3d0d8557a..12c3503879fb 100644
--- a/compiler/rustc_mir_transform/src/simplify_branches.rs
+++ b/compiler/rustc_mir_transform/src/simplify_branches.rs
@@ -60,4 +60,8 @@ impl<'tcx> crate::MirPass<'tcx> for SimplifyConstCondition {
};
}
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
diff --git a/compiler/rustc_mir_transform/src/simplify_comparison_integral.rs b/compiler/rustc_mir_transform/src/simplify_comparison_integral.rs
index b6d801730866..c0f25c7ecfeb 100644
--- a/compiler/rustc_mir_transform/src/simplify_comparison_integral.rs
+++ b/compiler/rustc_mir_transform/src/simplify_comparison_integral.rs
@@ -140,6 +140,10 @@ impl<'tcx> crate::MirPass<'tcx> for SimplifyComparisonIntegral {
body.basic_blocks_mut()[idx].statements.insert(0, stmt);
}
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
struct OptimizationFinder<'a, 'tcx> {
diff --git a/compiler/rustc_mir_transform/src/single_use_consts.rs b/compiler/rustc_mir_transform/src/single_use_consts.rs
index 10b3c0ae94f2..c5e951eb8b2c 100644
--- a/compiler/rustc_mir_transform/src/single_use_consts.rs
+++ b/compiler/rustc_mir_transform/src/single_use_consts.rs
@@ -81,6 +81,10 @@ impl<'tcx> crate::MirPass<'tcx> for SingleUseConsts {
}
}
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
#[derive(Copy, Clone, Debug)]
diff --git a/compiler/rustc_mir_transform/src/sroa.rs b/compiler/rustc_mir_transform/src/sroa.rs
index d54ea3feab6e..92e5c8a9ca42 100644
--- a/compiler/rustc_mir_transform/src/sroa.rs
+++ b/compiler/rustc_mir_transform/src/sroa.rs
@@ -48,6 +48,10 @@ impl<'tcx> crate::MirPass<'tcx> for ScalarReplacementOfAggregates {
}
}
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
/// Identify all locals that are not eligible for SROA.
diff --git a/compiler/rustc_mir_transform/src/strip_debuginfo.rs b/compiler/rustc_mir_transform/src/strip_debuginfo.rs
index 438c75726bb9..9ede8aa79c44 100644
--- a/compiler/rustc_mir_transform/src/strip_debuginfo.rs
+++ b/compiler/rustc_mir_transform/src/strip_debuginfo.rs
@@ -31,4 +31,8 @@ impl<'tcx> crate::MirPass<'tcx> for StripDebugInfo {
)
});
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
diff --git a/compiler/rustc_mir_transform/src/unreachable_enum_branching.rs b/compiler/rustc_mir_transform/src/unreachable_enum_branching.rs
index 55dcad0680a9..1ff7043ed14d 100644
--- a/compiler/rustc_mir_transform/src/unreachable_enum_branching.rs
+++ b/compiler/rustc_mir_transform/src/unreachable_enum_branching.rs
@@ -208,4 +208,8 @@ impl<'tcx> crate::MirPass<'tcx> for UnreachableEnumBranching {
patch.apply(body);
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
diff --git a/compiler/rustc_mir_transform/src/unreachable_prop.rs b/compiler/rustc_mir_transform/src/unreachable_prop.rs
index 734703ec78b5..1e5d9469c033 100644
--- a/compiler/rustc_mir_transform/src/unreachable_prop.rs
+++ b/compiler/rustc_mir_transform/src/unreachable_prop.rs
@@ -52,6 +52,10 @@ impl crate::MirPass<'_> for UnreachablePropagation {
body.basic_blocks_mut()[bb].statements.clear();
}
}
+
+ fn is_required(&self) -> bool {
+ false
+ }
}
/// Return whether the current terminator is fully unreachable.
diff --git a/compiler/rustc_mir_transform/src/validate.rs b/compiler/rustc_mir_transform/src/validate.rs
index b62e34ac08d0..026923ad786b 100644
--- a/compiler/rustc_mir_transform/src/validate.rs
+++ b/compiler/rustc_mir_transform/src/validate.rs
@@ -91,6 +91,10 @@ impl<'tcx> crate::MirPass<'tcx> for Validator {
}
}
}
+
+ fn is_required(&self) -> bool {
+ true
+ }
}
struct CfgChecker<'a, 'tcx> {
diff --git a/compiler/rustc_passes/messages.ftl b/compiler/rustc_passes/messages.ftl
index 133d84572e6d..978cb7af2427 100644
--- a/compiler/rustc_passes/messages.ftl
+++ b/compiler/rustc_passes/messages.ftl
@@ -812,6 +812,9 @@ passes_unused_duplicate =
passes_unused_empty_lints_note =
attribute `{$name}` with an empty list has no effect
+passes_unused_linker_warnings_note =
+ the `linker_warnings` lint can only be controlled at the root of a crate that needs to be linked
+
passes_unused_multiple =
multiple `{$name}` attributes
.suggestion = remove this attribute
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index 576ca24bf994..e19819a22b4f 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -25,6 +25,7 @@ use rustc_middle::traits::ObligationCause;
use rustc_middle::ty::error::{ExpectedFound, TypeError};
use rustc_middle::ty::{self, TyCtxt, TypingMode};
use rustc_middle::{bug, span_bug};
+use rustc_session::config::CrateType;
use rustc_session::lint::builtin::{
CONFLICTING_REPR_HINTS, INVALID_DOC_ATTRIBUTES, INVALID_MACRO_EXPORT_ARGUMENTS,
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES, UNUSED_ATTRIBUTES,
@@ -2327,6 +2328,42 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
&& item.path == sym::reason
{
errors::UnusedNote::NoLints { name: attr.name_or_empty() }
+ } else if matches!(
+ attr.name_or_empty(),
+ sym::allow | sym::warn | sym::deny | sym::forbid | sym::expect
+ ) && let Some(meta) = attr.meta_item_list()
+ && meta.iter().any(|meta| {
+ meta.meta_item().map_or(false, |item| item.path == sym::linker_messages)
+ })
+ {
+ if hir_id != CRATE_HIR_ID {
+ match attr.style {
+ ast::AttrStyle::Outer => self.tcx.emit_node_span_lint(
+ UNUSED_ATTRIBUTES,
+ hir_id,
+ attr.span,
+ errors::OuterCrateLevelAttr,
+ ),
+ ast::AttrStyle::Inner => self.tcx.emit_node_span_lint(
+ UNUSED_ATTRIBUTES,
+ hir_id,
+ attr.span,
+ errors::InnerCrateLevelAttr,
+ ),
+ };
+ return;
+ } else {
+ let never_needs_link = self
+ .tcx
+ .crate_types()
+ .iter()
+ .all(|kind| matches!(kind, CrateType::Rlib | CrateType::Staticlib));
+ if never_needs_link {
+ errors::UnusedNote::LinkerWarningsBinaryCrateOnly
+ } else {
+ return;
+ }
+ }
} else if attr.name_or_empty() == sym::default_method_body_is_const {
errors::UnusedNote::DefaultMethodBodyConst
} else {
diff --git a/compiler/rustc_passes/src/errors.rs b/compiler/rustc_passes/src/errors.rs
index 3d38b00e99f2..196a0a46962b 100644
--- a/compiler/rustc_passes/src/errors.rs
+++ b/compiler/rustc_passes/src/errors.rs
@@ -802,6 +802,8 @@ pub(crate) enum UnusedNote {
NoLints { name: Symbol },
#[note(passes_unused_default_method_body_const_note)]
DefaultMethodBodyConst,
+ #[note(passes_unused_linker_warnings_note)]
+ LinkerWarningsBinaryCrateOnly,
}
#[derive(LintDiagnostic)]
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs
index 43e4e4d591f8..ccd5b519cb04 100644
--- a/compiler/rustc_resolve/src/diagnostics.rs
+++ b/compiler/rustc_resolve/src/diagnostics.rs
@@ -24,6 +24,7 @@ use rustc_session::lint::builtin::{
MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS,
};
use rustc_session::lint::{AmbiguityErrorDiag, BuiltinLintDiag};
+use rustc_session::utils::was_invoked_from_cargo;
use rustc_span::edit_distance::find_best_match_for_name;
use rustc_span::edition::Edition;
use rustc_span::hygiene::MacroKind;
@@ -800,7 +801,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
}
err.multipart_suggestion(msg, suggestions, applicability);
}
-
if let Some(ModuleOrUniformRoot::Module(module)) = module
&& let Some(module) = module.opt_def_id()
&& let Some(segment) = segment
@@ -2034,13 +2034,23 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
(format!("`_` is not a valid crate or module name"), None)
} else if self.tcx.sess.is_rust_2015() {
(
- format!("you might be missing crate `{ident}`"),
+ format!("use of unresolved module or unlinked crate `{ident}`"),
Some((
vec![(
self.current_crate_outer_attr_insert_span,
format!("extern crate {ident};\n"),
)],
- format!("consider importing the `{ident}` crate"),
+ if was_invoked_from_cargo() {
+ format!(
+ "if you wanted to use a crate named `{ident}`, use `cargo add {ident}` \
+ to add it to your `Cargo.toml` and import it in your code",
+ )
+ } else {
+ format!(
+ "you might be missing a crate named `{ident}`, add it to your \
+ project and import it in your code",
+ )
+ },
Applicability::MaybeIncorrect,
)),
)
@@ -2219,7 +2229,25 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
let descr = binding.res().descr();
(format!("{descr} `{ident}` is not a crate or module"), suggestion)
} else {
- (format!("use of undeclared crate or module `{ident}`"), suggestion)
+ let suggestion = if suggestion.is_some() {
+ suggestion
+ } else if was_invoked_from_cargo() {
+ Some((
+ vec![],
+ format!(
+ "if you wanted to use a crate named `{ident}`, use `cargo add {ident}` \
+ to add it to your `Cargo.toml`",
+ ),
+ Applicability::MaybeIncorrect,
+ ))
+ } else {
+ Some((
+ vec![],
+ format!("you might be missing a crate named `{ident}`",),
+ Applicability::MaybeIncorrect,
+ ))
+ };
+ (format!("use of unresolved module or unlinked crate `{ident}`"), suggestion)
}
}
}
diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs
index 10f1ce376ef5..1f03de3f53db 100644
--- a/compiler/rustc_session/src/session.rs
+++ b/compiler/rustc_session/src/session.rs
@@ -895,13 +895,16 @@ fn default_emitter(
}
t => t,
};
+
+ let source_map = if sopts.unstable_opts.link_only { None } else { Some(source_map) };
+
match sopts.error_format {
config::ErrorOutputType::HumanReadable(kind, color_config) => {
let short = kind.short();
if let HumanReadableErrorType::AnnotateSnippet = kind {
let emitter = AnnotateSnippetEmitter::new(
- Some(source_map),
+ source_map,
bundle,
fallback_bundle,
short,
@@ -911,7 +914,7 @@ fn default_emitter(
} else {
let emitter = HumanEmitter::new(stderr_destination(color_config), fallback_bundle)
.fluent_bundle(bundle)
- .sm(Some(source_map))
+ .sm(source_map)
.short_message(short)
.teach(sopts.unstable_opts.teach)
.diagnostic_width(sopts.diagnostic_width)
@@ -1442,7 +1445,7 @@ fn mk_emitter(output: ErrorOutputType) -> Box {
config::ErrorOutputType::Json { pretty, json_rendered, color_config } => {
Box::new(JsonEmitter::new(
Box::new(io::BufWriter::new(io::stderr())),
- Lrc::new(SourceMap::new(FilePathMapping::empty())),
+ Some(Lrc::new(SourceMap::new(FilePathMapping::empty()))),
fallback_bundle,
pretty,
json_rendered,
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index f5ce5dbc9d66..1fb15fe98000 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -707,7 +707,6 @@ symbols! {
coverage,
coverage_attribute,
cr,
- crate_id,
crate_in_paths,
crate_local,
crate_name,
@@ -1189,6 +1188,7 @@ symbols! {
link_section,
linkage,
linker,
+ linker_messages,
lint_reasons,
literal,
load,
@@ -1389,7 +1389,6 @@ symbols! {
no_mangle,
no_sanitize,
no_stack_check,
- no_start,
no_std,
nomem,
non_ascii_idents,
diff --git a/library/core/src/ffi/va_list.rs b/library/core/src/ffi/va_list.rs
index f67c592d8d8f..cceb186b31e7 100644
--- a/library/core/src/ffi/va_list.rs
+++ b/library/core/src/ffi/va_list.rs
@@ -302,18 +302,28 @@ impl<'f> Drop for VaListImpl<'f> {
}
}
-extern "rust-intrinsic" {
- /// Destroy the arglist `ap` after initialization with `va_start` or
- /// `va_copy`.
- #[rustc_nounwind]
- fn va_end(ap: &mut VaListImpl<'_>);
-
- /// Copies the current location of arglist `src` to the arglist `dst`.
- #[rustc_nounwind]
- fn va_copy<'f>(dest: *mut VaListImpl<'f>, src: &VaListImpl<'f>);
-
- /// Loads an argument of type `T` from the `va_list` `ap` and increment the
- /// argument `ap` points to.
- #[rustc_nounwind]
- fn va_arg(ap: &mut VaListImpl<'_>) -> T;
+/// Destroy the arglist `ap` after initialization with `va_start` or
+/// `va_copy`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+unsafe fn va_end(_ap: &mut VaListImpl<'_>) {
+ unreachable!()
+}
+
+/// Copies the current location of arglist `src` to the arglist `dst`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+unsafe fn va_copy<'f>(_dest: *mut VaListImpl<'f>, _src: &VaListImpl<'f>) {
+ unreachable!()
+}
+
+/// Loads an argument of type `T` from the `va_list` `ap` and increment the
+/// argument `ap` points to.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+unsafe fn va_arg(_ap: &mut VaListImpl<'_>) -> T {
+ unreachable!()
}
diff --git a/library/core/src/intrinsics/simd.rs b/library/core/src/intrinsics/simd.rs
index d03d801b9365..e59d3aff3799 100644
--- a/library/core/src/intrinsics/simd.rs
+++ b/library/core/src/intrinsics/simd.rs
@@ -2,669 +2,939 @@
//!
//! In this module, a "vector" is any `repr(simd)` type.
-extern "rust-intrinsic" {
- /// Inserts an element into a vector, returning the updated vector.
- ///
- /// `T` must be a vector with element type `U`.
- ///
- /// # Safety
- ///
- /// `idx` must be in-bounds of the vector.
- #[rustc_nounwind]
- pub fn simd_insert(x: T, idx: u32, val: U) -> T;
-
- /// Extracts an element from a vector.
- ///
- /// `T` must be a vector with element type `U`.
- ///
- /// # Safety
- ///
- /// `idx` must be in-bounds of the vector.
- #[rustc_nounwind]
- pub fn simd_extract(x: T, idx: u32) -> U;
-
- /// Adds two simd vectors elementwise.
- ///
- /// `T` must be a vector of integer or floating point primitive types.
- #[rustc_nounwind]
- pub fn simd_add(x: T, y: T) -> T;
-
- /// Subtracts `rhs` from `lhs` elementwise.
- ///
- /// `T` must be a vector of integer or floating point primitive types.
- #[rustc_nounwind]
- pub fn simd_sub(lhs: T, rhs: T) -> T;
-
- /// Multiplies two simd vectors elementwise.
- ///
- /// `T` must be a vector of integer or floating point primitive types.
- #[rustc_nounwind]
- pub fn simd_mul(x: T, y: T) -> T;
-
- /// Divides `lhs` by `rhs` elementwise.
- ///
- /// `T` must be a vector of integer or floating point primitive types.
- ///
- /// # Safety
- /// For integers, `rhs` must not contain any zero elements.
- /// Additionally for signed integers, `::MIN / -1` is undefined behavior.
- #[rustc_nounwind]
- pub fn simd_div(lhs: T, rhs: T) -> T;
-
- /// Returns remainder of two vectors elementwise.
- ///
- /// `T` must be a vector of integer or floating point primitive types.
- ///
- /// # Safety
- /// For integers, `rhs` must not contain any zero elements.
- /// Additionally for signed integers, `::MIN / -1` is undefined behavior.
- #[rustc_nounwind]
- pub fn simd_rem(lhs: T, rhs: T) -> T;
-
- /// Shifts vector left elementwise, with UB on overflow.
- ///
- /// Shifts `lhs` left by `rhs`, shifting in sign bits for signed types.
- ///
- /// `T` must be a vector of integer primitive types.
- ///
- /// # Safety
- ///
- /// Each element of `rhs` must be less than `::BITS`.
- #[rustc_nounwind]
- pub fn simd_shl(lhs: T, rhs: T) -> T;
-
- /// Shifts vector right elementwise, with UB on overflow.
- ///
- /// `T` must be a vector of integer primitive types.
- ///
- /// Shifts `lhs` right by `rhs`, shifting in sign bits for signed types.
- ///
- /// # Safety
- ///
- /// Each element of `rhs` must be less than `::BITS`.
- #[rustc_nounwind]
- pub fn simd_shr(lhs: T, rhs: T) -> T;
-
- /// "Ands" vectors elementwise.
- ///
- /// `T` must be a vector of integer primitive types.
- #[rustc_nounwind]
- pub fn simd_and(x: T, y: T) -> T;
-
- /// "Ors" vectors elementwise.
- ///
- /// `T` must be a vector of integer primitive types.
- #[rustc_nounwind]
- pub fn simd_or(x: T, y: T) -> T;
-
- /// "Exclusive ors" vectors elementwise.
- ///
- /// `T` must be a vector of integer primitive types.
- #[rustc_nounwind]
- pub fn simd_xor(x: T, y: T) -> T;
-
- /// Numerically casts a vector, elementwise.
- ///
- /// `T` and `U` must be vectors of integer or floating point primitive types, and must have the
- /// same length.
- ///
- /// When casting floats to integers, the result is truncated. Out-of-bounds result lead to UB.
- /// When casting integers to floats, the result is rounded.
- /// Otherwise, truncates or extends the value, maintaining the sign for signed integers.
- ///
- /// # Safety
- /// Casting from integer types is always safe.
- /// Casting between two float types is also always safe.
- ///
- /// Casting floats to integers truncates, following the same rules as `to_int_unchecked`.
- /// Specifically, each element must:
- /// * Not be `NaN`
- /// * Not be infinite
- /// * Be representable in the return type, after truncating off its fractional part
- #[rustc_nounwind]
- pub fn simd_cast(x: T) -> U;
-
- /// Numerically casts a vector, elementwise.
- ///
- /// `T` and `U` be a vectors of integer or floating point primitive types, and must have the
- /// same length.
- ///
- /// Like `simd_cast`, but saturates float-to-integer conversions (NaN becomes 0).
- /// This matches regular `as` and is always safe.
- ///
- /// When casting floats to integers, the result is truncated.
- /// When casting integers to floats, the result is rounded.
- /// Otherwise, truncates or extends the value, maintaining the sign for signed integers.
- #[rustc_nounwind]
- pub fn simd_as(x: T) -> U;
-
- /// Negates a vector elementwise.
- ///
- /// `T` must be a vector of integer or floating-point primitive types.
- ///
- /// Rust panics for `-::Min` due to overflow, but it is not UB with this intrinsic.
- #[rustc_nounwind]
- pub fn simd_neg(x: T) -> T;
-
- /// Returns absolute value of a vector, elementwise.
- ///
- /// `T` must be a vector of floating-point primitive types.
- #[rustc_nounwind]
- pub fn simd_fabs(x: T) -> T;
-
- /// Returns the minimum of two vectors, elementwise.
- ///
- /// `T` must be a vector of floating-point primitive types.
- ///
- /// Follows IEEE-754 `minNum` semantics.
- #[rustc_nounwind]
- pub fn simd_fmin(x: T, y: T) -> T;
-
- /// Returns the maximum of two vectors, elementwise.
- ///
- /// `T` must be a vector of floating-point primitive types.
- ///
- /// Follows IEEE-754 `maxNum` semantics.
- #[rustc_nounwind]
- pub fn simd_fmax(x: T, y: T) -> T;
-
- /// Tests elementwise equality of two vectors.
- ///
- /// `T` must be a vector of floating-point primitive types.
- ///
- /// `U` must be a vector of integers with the same number of elements and element size as `T`.
- ///
- /// Returns `0` for false and `!0` for true.
- #[rustc_nounwind]
- pub fn simd_eq(x: T, y: T) -> U;
-
- /// Tests elementwise inequality equality of two vectors.
- ///
- /// `T` must be a vector of floating-point primitive types.
- ///
- /// `U` must be a vector of integers with the same number of elements and element size as `T`.
- ///
- /// Returns `0` for false and `!0` for true.
- #[rustc_nounwind]
- pub fn simd_ne(x: T, y: T) -> U;
-
- /// Tests if `x` is less than `y`, elementwise.
- ///
- /// `T` must be a vector of floating-point primitive types.
- ///
- /// `U` must be a vector of integers with the same number of elements and element size as `T`.
- ///
- /// Returns `0` for false and `!0` for true.
- #[rustc_nounwind]
- pub fn simd_lt(x: T, y: T) -> U;
-
- /// Tests if `x` is less than or equal to `y`, elementwise.
- ///
- /// `T` must be a vector of floating-point primitive types.
- ///
- /// `U` must be a vector of integers with the same number of elements and element size as `T`.
- ///
- /// Returns `0` for false and `!0` for true.
- #[rustc_nounwind]
- pub fn simd_le(x: T, y: T) -> U;
-
- /// Tests if `x` is greater than `y`, elementwise.
- ///
- /// `T` must be a vector of floating-point primitive types.
- ///
- /// `U` must be a vector of integers with the same number of elements and element size as `T`.
- ///
- /// Returns `0` for false and `!0` for true.
- #[rustc_nounwind]
- pub fn simd_gt(x: T, y: T) -> U;
-
- /// Tests if `x` is greater than or equal to `y`, elementwise.
- ///
- /// `T` must be a vector of floating-point primitive types.
- ///
- /// `U` must be a vector of integers with the same number of elements and element size as `T`.
- ///
- /// Returns `0` for false and `!0` for true.
- #[rustc_nounwind]
- pub fn simd_ge(x: T, y: T) -> U;
-
- /// Shuffles two vectors by const indices.
- ///
- /// `T` must be a vector.
- ///
- /// `U` must be a **const** vector of `u32`s. This means it must either refer to a named
- /// const or be given as an inline const expression (`const { ... }`).
- ///
- /// `V` must be a vector with the same element type as `T` and the same length as `U`.
- ///
- /// Returns a new vector such that element `i` is selected from `xy[idx[i]]`, where `xy`
- /// is the concatenation of `x` and `y`. It is a compile-time error if `idx[i]` is out-of-bounds
- /// of `xy`.
- #[rustc_nounwind]
- pub fn simd_shuffle(x: T, y: T, idx: U) -> V;
-
- /// Reads a vector of pointers.
- ///
- /// `T` must be a vector.
- ///
- /// `U` must be a vector of pointers to the element type of `T`, with the same length as `T`.
- ///
- /// `V` must be a vector of integers with the same length as `T` (but any element size).
- ///
- /// For each pointer in `ptr`, if the corresponding value in `mask` is `!0`, read the pointer.
- /// Otherwise if the corresponding value in `mask` is `0`, return the corresponding value from
- /// `val`.
- ///
- /// # Safety
- /// Unmasked values in `T` must be readable as if by `::read` (e.g. aligned to the element
- /// type).
- ///
- /// `mask` must only contain `0` or `!0` values.
- #[rustc_nounwind]
- pub fn simd_gather(val: T, ptr: U, mask: V) -> T;
-
- /// Writes to a vector of pointers.
- ///
- /// `T` must be a vector.
- ///
- /// `U` must be a vector of pointers to the element type of `T`, with the same length as `T`.
- ///
- /// `V` must be a vector of integers with the same length as `T` (but any element size).
- ///
- /// For each pointer in `ptr`, if the corresponding value in `mask` is `!0`, write the
- /// corresponding value in `val` to the pointer.
- /// Otherwise if the corresponding value in `mask` is `0`, do nothing.
- ///
- /// The stores happen in left-to-right order.
- /// (This is relevant in case two of the stores overlap.)
- ///
- /// # Safety
- /// Unmasked values in `T` must be writeable as if by `::write` (e.g. aligned to the element
- /// type).
- ///
- /// `mask` must only contain `0` or `!0` values.
- #[rustc_nounwind]
- pub fn simd_scatter(val: T, ptr: U, mask: V);
-
- /// Reads a vector of pointers.
- ///
- /// `T` must be a vector.
- ///
- /// `U` must be a pointer to the element type of `T`
- ///
- /// `V` must be a vector of integers with the same length as `T` (but any element size).
- ///
- /// For each element, if the corresponding value in `mask` is `!0`, read the corresponding
- /// pointer offset from `ptr`.
- /// The first element is loaded from `ptr`, the second from `ptr.wrapping_offset(1)` and so on.
- /// Otherwise if the corresponding value in `mask` is `0`, return the corresponding value from
- /// `val`.
- ///
- /// # Safety
- /// Unmasked values in `T` must be readable as if by `::read` (e.g. aligned to the element
- /// type).
- ///
- /// `mask` must only contain `0` or `!0` values.
- #[rustc_nounwind]
- pub fn simd_masked_load(mask: V, ptr: U, val: T) -> T;
-
- /// Writes to a vector of pointers.
- ///
- /// `T` must be a vector.
- ///
- /// `U` must be a pointer to the element type of `T`
- ///
- /// `V` must be a vector of integers with the same length as `T` (but any element size).
- ///
- /// For each element, if the corresponding value in `mask` is `!0`, write the corresponding
- /// value in `val` to the pointer offset from `ptr`.
- /// The first element is written to `ptr`, the second to `ptr.wrapping_offset(1)` and so on.
- /// Otherwise if the corresponding value in `mask` is `0`, do nothing.
- ///
- /// # Safety
- /// Unmasked values in `T` must be writeable as if by `::write` (e.g. aligned to the element
- /// type).
- ///
- /// `mask` must only contain `0` or `!0` values.
- #[rustc_nounwind]
- pub fn simd_masked_store(mask: V, ptr: U, val: T);
-
- /// Adds two simd vectors elementwise, with saturation.
- ///
- /// `T` must be a vector of integer primitive types.
- #[rustc_nounwind]
- pub fn simd_saturating_add(x: T, y: T) -> T;
-
- /// Subtracts two simd vectors elementwise, with saturation.
- ///
- /// `T` must be a vector of integer primitive types.
- ///
- /// Subtract `rhs` from `lhs`.
- #[rustc_nounwind]
- pub fn simd_saturating_sub(lhs: T, rhs: T) -> T;
-
- /// Adds elements within a vector from left to right.
- ///
- /// `T` must be a vector of integer or floating-point primitive types.
- ///
- /// `U` must be the element type of `T`.
- ///
- /// Starting with the value `y`, add the elements of `x` and accumulate.
- #[rustc_nounwind]
- pub fn simd_reduce_add_ordered(x: T, y: U) -> U;
-
- /// Adds elements within a vector in arbitrary order. May also be re-associated with
- /// unordered additions on the inputs/outputs.
- ///
- /// `T` must be a vector of integer or floating-point primitive types.
- ///
- /// `U` must be the element type of `T`.
- #[rustc_nounwind]
- pub fn simd_reduce_add_unordered(x: T) -> U;
-
- /// Multiplies elements within a vector from left to right.
- ///
- /// `T` must be a vector of integer or floating-point primitive types.
- ///
- /// `U` must be the element type of `T`.
- ///
- /// Starting with the value `y`, multiply the elements of `x` and accumulate.
- #[rustc_nounwind]
- pub fn simd_reduce_mul_ordered(x: T, y: U) -> U;
-
- /// Multiplies elements within a vector in arbitrary order. May also be re-associated with
- /// unordered additions on the inputs/outputs.
- ///
- /// `T` must be a vector of integer or floating-point primitive types.
- ///
- /// `U` must be the element type of `T`.
- #[rustc_nounwind]
- pub fn simd_reduce_mul_unordered(x: T) -> U;
-
- /// Checks if all mask values are true.
- ///
- /// `T` must be a vector of integer primitive types.
- ///
- /// # Safety
- /// `x` must contain only `0` or `!0`.
- #[rustc_nounwind]
- pub fn simd_reduce_all(x: T) -> bool;
-
- /// Checks if any mask value is true.
- ///
- /// `T` must be a vector of integer primitive types.
- ///
- /// # Safety
- /// `x` must contain only `0` or `!0`.
- #[rustc_nounwind]
- pub fn simd_reduce_any(x: T) -> bool;
-
- /// Returns the maximum element of a vector.
- ///
- /// `T` must be a vector of integer or floating-point primitive types.
- ///
- /// `U` must be the element type of `T`.
- ///
- /// For floating-point values, uses IEEE-754 `maxNum`.
- #[rustc_nounwind]
- pub fn simd_reduce_max(x: T) -> U;
-
- /// Returns the minimum element of a vector.
- ///
- /// `T` must be a vector of integer or floating-point primitive types.
- ///
- /// `U` must be the element type of `T`.
- ///
- /// For floating-point values, uses IEEE-754 `minNum`.
- #[rustc_nounwind]
- pub fn simd_reduce_min(x: T) -> U;
-
- /// Logical "ands" all elements together.
- ///
- /// `T` must be a vector of integer or floating-point primitive types.
- ///
- /// `U` must be the element type of `T`.
- #[rustc_nounwind]
- pub fn simd_reduce_and(x: T) -> U;
-
- /// Logical "ors" all elements together.
- ///
- /// `T` must be a vector of integer or floating-point primitive types.
- ///
- /// `U` must be the element type of `T`.
- #[rustc_nounwind]
- pub fn simd_reduce_or(x: T) -> U;
-
- /// Logical "exclusive ors" all elements together.
- ///
- /// `T` must be a vector of integer or floating-point primitive types.
- ///
- /// `U` must be the element type of `T`.
- #[rustc_nounwind]
- pub fn simd_reduce_xor(x: T) -> U;
-
- /// Truncates an integer vector to a bitmask.
- ///
- /// `T` must be an integer vector.
- ///
- /// `U` must be either the smallest unsigned integer with at least as many bits as the length
- /// of `T`, or the smallest array of `u8` with at least as many bits as the length of `T`.
- ///
- /// Each element is truncated to a single bit and packed into the result.
- ///
- /// No matter whether the output is an array or an unsigned integer, it is treated as a single
- /// contiguous list of bits. The bitmask is always packed on the least-significant side of the
- /// output, and padded with 0s in the most-significant bits. The order of the bits depends on
- /// endianness:
- ///
- /// * On little endian, the least significant bit corresponds to the first vector element.
- /// * On big endian, the least significant bit corresponds to the last vector element.
- ///
- /// For example, `[!0, 0, !0, !0]` packs to
- /// - `0b1101u8` or `[0b1101]` on little endian, and
- /// - `0b1011u8` or `[0b1011]` on big endian.
- ///
- /// To consider a larger example,
- /// `[!0, 0, 0, 0, 0, 0, 0, 0, !0, !0, 0, 0, 0, 0, !0, 0]` packs to
- /// - `0b0100001100000001u16` or `[0b00000001, 0b01000011]` on little endian, and
- /// - `0b1000000011000010u16` or `[0b10000000, 0b11000010]` on big endian.
- ///
- /// And finally, a non-power-of-2 example with multiple bytes:
- /// `[!0, !0, 0, !0, 0, 0, !0, 0, !0, 0]` packs to
- /// - `0b0101001011u16` or `[0b01001011, 0b01]` on little endian, and
- /// - `0b1101001010u16` or `[0b11, 0b01001010]` on big endian.
- ///
- /// # Safety
- /// `x` must contain only `0` and `!0`.
- #[rustc_nounwind]
- pub fn simd_bitmask(x: T) -> U;
-
- /// Selects elements from a mask.
- ///
- /// `M` must be an integer vector.
- ///
- /// `T` must be a vector with the same number of elements as `M`.
- ///
- /// For each element, if the corresponding value in `mask` is `!0`, select the element from
- /// `if_true`. If the corresponding value in `mask` is `0`, select the element from
- /// `if_false`.
- ///
- /// # Safety
- /// `mask` must only contain `0` and `!0`.
- #[rustc_nounwind]
- pub fn simd_select(mask: M, if_true: T, if_false: T) -> T;
-
- /// Selects elements from a bitmask.
- ///
- /// `M` must be an unsigned integer or array of `u8`, matching `simd_bitmask`.
- ///
- /// `T` must be a vector.
- ///
- /// For each element, if the bit in `mask` is `1`, select the element from
- /// `if_true`. If the corresponding bit in `mask` is `0`, select the element from
- /// `if_false`.
- ///
- /// The bitmask bit order matches `simd_bitmask`.
- ///
- /// # Safety
- /// Padding bits must be all zero.
- #[rustc_nounwind]
- pub fn simd_select_bitmask(m: M, yes: T, no: T) -> T;
-
- /// Calculates the offset from a pointer vector elementwise, potentially
- /// wrapping.
- ///
- /// `T` must be a vector of pointers.
- ///
- /// `U` must be a vector of `isize` or `usize` with the same number of elements as `T`.
- ///
- /// Operates as if by `::wrapping_offset`.
- #[rustc_nounwind]
- pub fn simd_arith_offset(ptr: T, offset: U) -> T;
-
- /// Casts a vector of pointers.
- ///
- /// `T` and `U` must be vectors of pointers with the same number of elements.
- #[rustc_nounwind]
- pub fn simd_cast_ptr(ptr: T) -> U;
-
- /// Exposes a vector of pointers as a vector of addresses.
- ///
- /// `T` must be a vector of pointers.
- ///
- /// `U` must be a vector of `usize` with the same length as `T`.
- #[rustc_nounwind]
- pub fn simd_expose_provenance(ptr: T) -> U;
-
- /// Creates a vector of pointers from a vector of addresses.
- ///
- /// `T` must be a vector of `usize`.
- ///
- /// `U` must be a vector of pointers, with the same length as `T`.
- #[rustc_nounwind]
- pub fn simd_with_exposed_provenance(addr: T) -> U;
-
- /// Swaps bytes of each element.
- ///
- /// `T` must be a vector of integers.
- #[rustc_nounwind]
- pub fn simd_bswap(x: T) -> T;
-
- /// Reverses bits of each element.
- ///
- /// `T` must be a vector of integers.
- #[rustc_nounwind]
- pub fn simd_bitreverse(x: T) -> T;
-
- /// Counts the leading zeros of each element.
- ///
- /// `T` must be a vector of integers.
- #[rustc_nounwind]
- pub fn simd_ctlz(x: T) -> T;
-
- /// Counts the number of ones in each element.
- ///
- /// `T` must be a vector of integers.
- #[rustc_nounwind]
- pub fn simd_ctpop(x: T) -> T;
-
- /// Counts the trailing zeros of each element.
- ///
- /// `T` must be a vector of integers.
- #[rustc_nounwind]
- pub fn simd_cttz(x: T) -> T;
-
- /// Rounds up each element to the next highest integer-valued float.
- ///
- /// `T` must be a vector of floats.
- #[rustc_nounwind]
- pub fn simd_ceil(x: T) -> T;
-
- /// Rounds down each element to the next lowest integer-valued float.
- ///
- /// `T` must be a vector of floats.
- #[rustc_nounwind]
- pub fn simd_floor(x: T) -> T;
-
- /// Rounds each element to the closest integer-valued float.
- /// Ties are resolved by rounding away from 0.
- ///
- /// `T` must be a vector of floats.
- #[rustc_nounwind]
- pub fn simd_round(x: T) -> T;
-
- /// Returns the integer part of each element as an integer-valued float.
- /// In other words, non-integer values are truncated towards zero.
- ///
- /// `T` must be a vector of floats.
- #[rustc_nounwind]
- pub fn simd_trunc(x: T) -> T;
-
- /// Takes the square root of each element.
- ///
- /// `T` must be a vector of floats.
- #[rustc_nounwind]
- pub fn simd_fsqrt(x: T) -> T;
-
- /// Computes `(x*y) + z` for each element, but without any intermediate rounding.
- ///
- /// `T` must be a vector of floats.
- #[rustc_nounwind]
- pub fn simd_fma(x: T, y: T, z: T) -> T;
-
- /// Computes `(x*y) + z` for each element, non-deterministically executing either
- /// a fused multiply-add or two operations with rounding of the intermediate result.
- ///
- /// The operation is fused if the code generator determines that target instruction
- /// set has support for a fused operation, and that the fused operation is more efficient
- /// than the equivalent, separate pair of mul and add instructions. It is unspecified
- /// whether or not a fused operation is selected, and that may depend on optimization
- /// level and context, for example. It may even be the case that some SIMD lanes get fused
- /// and others do not.
- ///
- /// `T` must be a vector of floats.
- #[rustc_nounwind]
- pub fn simd_relaxed_fma(x: T, y: T, z: T) -> T;
-
- // Computes the sine of each element.
- ///
- /// `T` must be a vector of floats.
- #[rustc_nounwind]
- pub fn simd_fsin(a: T) -> T;
-
- // Computes the cosine of each element.
- ///
- /// `T` must be a vector of floats.
- #[rustc_nounwind]
- pub fn simd_fcos(a: T) -> T;
-
- // Computes the exponential function of each element.
- ///
- /// `T` must be a vector of floats.
- #[rustc_nounwind]
- pub fn simd_fexp(a: T) -> T;
-
- // Computes 2 raised to the power of each element.
- ///
- /// `T` must be a vector of floats.
- #[rustc_nounwind]
- pub fn simd_fexp2(a: T) -> T;
-
- // Computes the base 10 logarithm of each element.
- ///
- /// `T` must be a vector of floats.
- #[rustc_nounwind]
- pub fn simd_flog10(a: T) -> T;
-
- // Computes the base 2 logarithm of each element.
- ///
- /// `T` must be a vector of floats.
- #[rustc_nounwind]
- pub fn simd_flog2(a: T) -> T;
-
- // Computes the natural logarithm of each element.
- ///
- /// `T` must be a vector of floats.
- #[rustc_nounwind]
- pub fn simd_flog(a: T) -> T;
+/// Inserts an element into a vector, returning the updated vector.
+///
+/// `T` must be a vector with element type `U`.
+///
+/// # Safety
+///
+/// `idx` must be in-bounds of the vector.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_insert(_x: T, _idx: u32, _val: U) -> T {
+ unreachable!()
+}
+
+/// Extracts an element from a vector.
+///
+/// `T` must be a vector with element type `U`.
+///
+/// # Safety
+///
+/// `idx` must be in-bounds of the vector.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_extract(_x: T, _idx: u32) -> U {
+ unreachable!()
+}
+
+/// Adds two simd vectors elementwise.
+///
+/// `T` must be a vector of integer or floating point primitive types.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_add(_x: T, _y: T) -> T {
+ unreachable!()
+}
+
+/// Subtracts `rhs` from `lhs` elementwise.
+///
+/// `T` must be a vector of integer or floating point primitive types.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_sub(_lhs: T, _rhs: T) -> T {
+ unreachable!()
+}
+
+/// Multiplies two simd vectors elementwise.
+///
+/// `T` must be a vector of integer or floating point primitive types.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_mul(_x: T, _y: T) -> T {
+ unreachable!()
+}
+
+/// Divides `lhs` by `rhs` elementwise.
+///
+/// `T` must be a vector of integer or floating point primitive types.
+///
+/// # Safety
+/// For integers, `rhs` must not contain any zero elements.
+/// Additionally for signed integers, `::MIN / -1` is undefined behavior.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_div(_lhs: T, _rhs: T) -> T {
+ unreachable!()
+}
+
+/// Returns remainder of two vectors elementwise.
+///
+/// `T` must be a vector of integer or floating point primitive types.
+///
+/// # Safety
+/// For integers, `rhs` must not contain any zero elements.
+/// Additionally for signed integers, `::MIN / -1` is undefined behavior.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_rem(_lhs: T, _rhs: T) -> T {
+ unreachable!()
+}
+
+/// Shifts vector left elementwise, with UB on overflow.
+///
+/// Shifts `lhs` left by `rhs`, shifting in sign bits for signed types.
+///
+/// `T` must be a vector of integer primitive types.
+///
+/// # Safety
+///
+/// Each element of `rhs` must be less than `::BITS`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_shl(_lhs: T, _rhs: T) -> T {
+ unreachable!()
+}
+
+/// Shifts vector right elementwise, with UB on overflow.
+///
+/// `T` must be a vector of integer primitive types.
+///
+/// Shifts `lhs` right by `rhs`, shifting in sign bits for signed types.
+///
+/// # Safety
+///
+/// Each element of `rhs` must be less than `::BITS`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_shr(_lhs: T, _rhs: T) -> T {
+ unreachable!()
+}
+
+/// "Ands" vectors elementwise.
+///
+/// `T` must be a vector of integer primitive types.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_and(_x: T, _y: T) -> T {
+ unreachable!()
+}
+
+/// "Ors" vectors elementwise.
+///
+/// `T` must be a vector of integer primitive types.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_or(_x: T, _y: T) -> T {
+ unreachable!()
+}
+
+/// "Exclusive ors" vectors elementwise.
+///
+/// `T` must be a vector of integer primitive types.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_xor(_x: T, _y: T) -> T {
+ unreachable!()
+}
+
+/// Numerically casts a vector, elementwise.
+///
+/// `T` and `U` must be vectors of integer or floating point primitive types, and must have the
+/// same length.
+///
+/// When casting floats to integers, the result is truncated. Out-of-bounds result lead to UB.
+/// When casting integers to floats, the result is rounded.
+/// Otherwise, truncates or extends the value, maintaining the sign for signed integers.
+///
+/// # Safety
+/// Casting from integer types is always safe.
+/// Casting between two float types is also always safe.
+///
+/// Casting floats to integers truncates, following the same rules as `to_int_unchecked`.
+/// Specifically, each element must:
+/// * Not be `NaN`
+/// * Not be infinite
+/// * Be representable in the return type, after truncating off its fractional part
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_cast(_x: T) -> U {
+ unreachable!()
+}
+
+/// Numerically casts a vector, elementwise.
+///
+/// `T` and `U` be a vectors of integer or floating point primitive types, and must have the
+/// same length.
+///
+/// Like `simd_cast`, but saturates float-to-integer conversions (NaN becomes 0).
+/// This matches regular `as` and is always safe.
+///
+/// When casting floats to integers, the result is truncated.
+/// When casting integers to floats, the result is rounded.
+/// Otherwise, truncates or extends the value, maintaining the sign for signed integers.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_as(_x: T) -> U {
+ unreachable!()
+}
+
+/// Negates a vector elementwise.
+///
+/// `T` must be a vector of integer or floating-point primitive types.
+///
+/// Rust panics for `-::Min` due to overflow, but it is not UB with this intrinsic.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_neg(_x: T) -> T {
+ unreachable!()
+}
+
+/// Returns absolute value of a vector, elementwise.
+///
+/// `T` must be a vector of floating-point primitive types.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_fabs(_x: T) -> T {
+ unreachable!()
+}
+
+/// Returns the minimum of two vectors, elementwise.
+///
+/// `T` must be a vector of floating-point primitive types.
+///
+/// Follows IEEE-754 `minNum` semantics.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_fmin(_x: T, _y: T) -> T {
+ unreachable!()
+}
+
+/// Returns the maximum of two vectors, elementwise.
+///
+/// `T` must be a vector of floating-point primitive types.
+///
+/// Follows IEEE-754 `maxNum` semantics.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_fmax(_x: T, _y: T) -> T {
+ unreachable!()
+}
+
+/// Tests elementwise equality of two vectors.
+///
+/// `T` must be a vector of floating-point primitive types.
+///
+/// `U` must be a vector of integers with the same number of elements and element size as `T`.
+///
+/// Returns `0` for false and `!0` for true.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_eq(_x: T, _y: T) -> U {
+ unreachable!()
+}
+
+/// Tests elementwise inequality equality of two vectors.
+///
+/// `T` must be a vector of floating-point primitive types.
+///
+/// `U` must be a vector of integers with the same number of elements and element size as `T`.
+///
+/// Returns `0` for false and `!0` for true.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_ne(_x: T, _y: T) -> U {
+ unreachable!()
+}
+
+/// Tests if `x` is less than `y`, elementwise.
+///
+/// `T` must be a vector of floating-point primitive types.
+///
+/// `U` must be a vector of integers with the same number of elements and element size as `T`.
+///
+/// Returns `0` for false and `!0` for true.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_lt(_x: T, _y: T) -> U {
+ unreachable!()
+}
+
+/// Tests if `x` is less than or equal to `y`, elementwise.
+///
+/// `T` must be a vector of floating-point primitive types.
+///
+/// `U` must be a vector of integers with the same number of elements and element size as `T`.
+///
+/// Returns `0` for false and `!0` for true.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_le(_x: T, _y: T) -> U {
+ unreachable!()
+}
+
+/// Tests if `x` is greater than `y`, elementwise.
+///
+/// `T` must be a vector of floating-point primitive types.
+///
+/// `U` must be a vector of integers with the same number of elements and element size as `T`.
+///
+/// Returns `0` for false and `!0` for true.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_gt(_x: T, _y: T) -> U {
+ unreachable!()
+}
+
+/// Tests if `x` is greater than or equal to `y`, elementwise.
+///
+/// `T` must be a vector of floating-point primitive types.
+///
+/// `U` must be a vector of integers with the same number of elements and element size as `T`.
+///
+/// Returns `0` for false and `!0` for true.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_ge(_x: T, _y: T) -> U {
+ unreachable!()
+}
+
+/// Shuffles two vectors by const indices.
+///
+/// `T` must be a vector.
+///
+/// `U` must be a **const** vector of `u32`s. This means it must either refer to a named
+/// const or be given as an inline const expression (`const { ... }`).
+///
+/// `V` must be a vector with the same element type as `T` and the same length as `U`.
+///
+/// Returns a new vector such that element `i` is selected from `xy[idx[i]]`, where `xy`
+/// is the concatenation of `x` and `y`. It is a compile-time error if `idx[i]` is out-of-bounds
+/// of `xy`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_shuffle(_x: T, _y: T, _idx: U) -> V {
+ unreachable!()
+}
+
+/// Reads a vector of pointers.
+///
+/// `T` must be a vector.
+///
+/// `U` must be a vector of pointers to the element type of `T`, with the same length as `T`.
+///
+/// `V` must be a vector of integers with the same length as `T` (but any element size).
+///
+/// For each pointer in `ptr`, if the corresponding value in `mask` is `!0`, read the pointer.
+/// Otherwise if the corresponding value in `mask` is `0`, return the corresponding value from
+/// `val`.
+///
+/// # Safety
+/// Unmasked values in `T` must be readable as if by `::read` (e.g. aligned to the element
+/// type).
+///
+/// `mask` must only contain `0` or `!0` values.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_gather(_val: T, _ptr: U, _mask: V) -> T {
+ unreachable!()
+}
+
+/// Writes to a vector of pointers.
+///
+/// `T` must be a vector.
+///
+/// `U` must be a vector of pointers to the element type of `T`, with the same length as `T`.
+///
+/// `V` must be a vector of integers with the same length as `T` (but any element size).
+///
+/// For each pointer in `ptr`, if the corresponding value in `mask` is `!0`, write the
+/// corresponding value in `val` to the pointer.
+/// Otherwise if the corresponding value in `mask` is `0`, do nothing.
+///
+/// The stores happen in left-to-right order.
+/// (This is relevant in case two of the stores overlap.)
+///
+/// # Safety
+/// Unmasked values in `T` must be writeable as if by `::write` (e.g. aligned to the element
+/// type).
+///
+/// `mask` must only contain `0` or `!0` values.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_scatter(_val: T, _ptr: U, _mask: V) {
+ unreachable!()
+}
+
+/// Reads a vector of pointers.
+///
+/// `T` must be a vector.
+///
+/// `U` must be a pointer to the element type of `T`
+///
+/// `V` must be a vector of integers with the same length as `T` (but any element size).
+///
+/// For each element, if the corresponding value in `mask` is `!0`, read the corresponding
+/// pointer offset from `ptr`.
+/// The first element is loaded from `ptr`, the second from `ptr.wrapping_offset(1)` and so on.
+/// Otherwise if the corresponding value in `mask` is `0`, return the corresponding value from
+/// `val`.
+///
+/// # Safety
+/// Unmasked values in `T` must be readable as if by `::read` (e.g. aligned to the element
+/// type).
+///
+/// `mask` must only contain `0` or `!0` values.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_masked_load(_mask: V, _ptr: U, _val: T) -> T {
+ unreachable!()
+}
+
+/// Writes to a vector of pointers.
+///
+/// `T` must be a vector.
+///
+/// `U` must be a pointer to the element type of `T`
+///
+/// `V` must be a vector of integers with the same length as `T` (but any element size).
+///
+/// For each element, if the corresponding value in `mask` is `!0`, write the corresponding
+/// value in `val` to the pointer offset from `ptr`.
+/// The first element is written to `ptr`, the second to `ptr.wrapping_offset(1)` and so on.
+/// Otherwise if the corresponding value in `mask` is `0`, do nothing.
+///
+/// # Safety
+/// Unmasked values in `T` must be writeable as if by `::write` (e.g. aligned to the element
+/// type).
+///
+/// `mask` must only contain `0` or `!0` values.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_masked_store(_mask: V, _ptr: U, _val: T) {
+ unreachable!()
+}
+
+/// Adds two simd vectors elementwise, with saturation.
+///
+/// `T` must be a vector of integer primitive types.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_saturating_add(_x: T, _y: T) -> T {
+ unreachable!()
+}
+
+/// Subtracts two simd vectors elementwise, with saturation.
+///
+/// `T` must be a vector of integer primitive types.
+///
+/// Subtract `rhs` from `lhs`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_saturating_sub(_lhs: T, _rhs: T) -> T {
+ unreachable!()
+}
+
+/// Adds elements within a vector from left to right.
+///
+/// `T` must be a vector of integer or floating-point primitive types.
+///
+/// `U` must be the element type of `T`.
+///
+/// Starting with the value `y`, add the elements of `x` and accumulate.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_reduce_add_ordered(_x: T, _y: U) -> U {
+ unreachable!()
+}
+
+/// Adds elements within a vector in arbitrary order. May also be re-associated with
+/// unordered additions on the inputs/outputs.
+///
+/// `T` must be a vector of integer or floating-point primitive types.
+///
+/// `U` must be the element type of `T`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_reduce_add_unordered(_x: T) -> U {
+ unreachable!()
+}
+
+/// Multiplies elements within a vector from left to right.
+///
+/// `T` must be a vector of integer or floating-point primitive types.
+///
+/// `U` must be the element type of `T`.
+///
+/// Starting with the value `y`, multiply the elements of `x` and accumulate.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_reduce_mul_ordered(_x: T, _y: U) -> U {
+ unreachable!()
+}
+
+/// Multiplies elements within a vector in arbitrary order. May also be re-associated with
+/// unordered additions on the inputs/outputs.
+///
+/// `T` must be a vector of integer or floating-point primitive types.
+///
+/// `U` must be the element type of `T`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_reduce_mul_unordered(_x: T) -> U {
+ unreachable!()
+}
+
+/// Checks if all mask values are true.
+///
+/// `T` must be a vector of integer primitive types.
+///
+/// # Safety
+/// `x` must contain only `0` or `!0`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_reduce_all(_x: T) -> bool {
+ unreachable!()
+}
+
+/// Checks if any mask value is true.
+///
+/// `T` must be a vector of integer primitive types.
+///
+/// # Safety
+/// `x` must contain only `0` or `!0`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_reduce_any(_x: T) -> bool {
+ unreachable!()
+}
+
+/// Returns the maximum element of a vector.
+///
+/// `T` must be a vector of integer or floating-point primitive types.
+///
+/// `U` must be the element type of `T`.
+///
+/// For floating-point values, uses IEEE-754 `maxNum`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_reduce_max(_x: T) -> U {
+ unreachable!()
+}
+
+/// Returns the minimum element of a vector.
+///
+/// `T` must be a vector of integer or floating-point primitive types.
+///
+/// `U` must be the element type of `T`.
+///
+/// For floating-point values, uses IEEE-754 `minNum`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_reduce_min(_x: T) -> U {
+ unreachable!()
+}
+
+/// Logical "ands" all elements together.
+///
+/// `T` must be a vector of integer or floating-point primitive types.
+///
+/// `U` must be the element type of `T`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_reduce_and(_x: T) -> U {
+ unreachable!()
+}
+
+/// Logical "ors" all elements together.
+///
+/// `T` must be a vector of integer or floating-point primitive types.
+///
+/// `U` must be the element type of `T`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_reduce_or(_x: T) -> U {
+ unreachable!()
+}
+
+/// Logical "exclusive ors" all elements together.
+///
+/// `T` must be a vector of integer or floating-point primitive types.
+///
+/// `U` must be the element type of `T`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_reduce_xor(_x: T) -> U {
+ unreachable!()
+}
+
+/// Truncates an integer vector to a bitmask.
+///
+/// `T` must be an integer vector.
+///
+/// `U` must be either the smallest unsigned integer with at least as many bits as the length
+/// of `T`, or the smallest array of `u8` with at least as many bits as the length of `T`.
+///
+/// Each element is truncated to a single bit and packed into the result.
+///
+/// No matter whether the output is an array or an unsigned integer, it is treated as a single
+/// contiguous list of bits. The bitmask is always packed on the least-significant side of the
+/// output, and padded with 0s in the most-significant bits. The order of the bits depends on
+/// endianness:
+///
+/// * On little endian, the least significant bit corresponds to the first vector element.
+/// * On big endian, the least significant bit corresponds to the last vector element.
+///
+/// For example, `[!0, 0, !0, !0]` packs to
+/// - `0b1101u8` or `[0b1101]` on little endian, and
+/// - `0b1011u8` or `[0b1011]` on big endian.
+///
+/// To consider a larger example,
+/// `[!0, 0, 0, 0, 0, 0, 0, 0, !0, !0, 0, 0, 0, 0, !0, 0]` packs to
+/// - `0b0100001100000001u16` or `[0b00000001, 0b01000011]` on little endian, and
+/// - `0b1000000011000010u16` or `[0b10000000, 0b11000010]` on big endian.
+///
+/// And finally, a non-power-of-2 example with multiple bytes:
+/// `[!0, !0, 0, !0, 0, 0, !0, 0, !0, 0]` packs to
+/// - `0b0101001011u16` or `[0b01001011, 0b01]` on little endian, and
+/// - `0b1101001010u16` or `[0b11, 0b01001010]` on big endian.
+///
+/// # Safety
+/// `x` must contain only `0` and `!0`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_bitmask(_x: T) -> U {
+ unreachable!()
+}
+
+/// Selects elements from a mask.
+///
+/// `M` must be an integer vector.
+///
+/// `T` must be a vector with the same number of elements as `M`.
+///
+/// For each element, if the corresponding value in `mask` is `!0`, select the element from
+/// `if_true`. If the corresponding value in `mask` is `0`, select the element from
+/// `if_false`.
+///
+/// # Safety
+/// `mask` must only contain `0` and `!0`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_select(_mask: M, _if_true: T, _if_false: T) -> T {
+ unreachable!()
+}
+
+/// Selects elements from a bitmask.
+///
+/// `M` must be an unsigned integer or array of `u8`, matching `simd_bitmask`.
+///
+/// `T` must be a vector.
+///
+/// For each element, if the bit in `mask` is `1`, select the element from
+/// `if_true`. If the corresponding bit in `mask` is `0`, select the element from
+/// `if_false`.
+///
+/// The bitmask bit order matches `simd_bitmask`.
+///
+/// # Safety
+/// Padding bits must be all zero.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_select_bitmask(_m: M, _yes: T, _no: T) -> T {
+ unreachable!()
+}
+
+/// Calculates the offset from a pointer vector elementwise, potentially
+/// wrapping.
+///
+/// `T` must be a vector of pointers.
+///
+/// `U` must be a vector of `isize` or `usize` with the same number of elements as `T`.
+///
+/// Operates as if by `::wrapping_offset`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_arith_offset(_ptr: T, _offset: U) -> T {
+ unreachable!()
+}
+
+/// Casts a vector of pointers.
+///
+/// `T` and `U` must be vectors of pointers with the same number of elements.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_cast_ptr(_ptr: T) -> U {
+ unreachable!()
+}
+
+/// Exposes a vector of pointers as a vector of addresses.
+///
+/// `T` must be a vector of pointers.
+///
+/// `U` must be a vector of `usize` with the same length as `T`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_expose_provenance(_ptr: T) -> U {
+ unreachable!()
+}
+
+/// Creates a vector of pointers from a vector of addresses.
+///
+/// `T` must be a vector of `usize`.
+///
+/// `U` must be a vector of pointers, with the same length as `T`.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_with_exposed_provenance(_addr: T) -> U {
+ unreachable!()
+}
+
+/// Swaps bytes of each element.
+///
+/// `T` must be a vector of integers.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_bswap(_x: T) -> T {
+ unreachable!()
+}
+
+/// Reverses bits of each element.
+///
+/// `T` must be a vector of integers.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_bitreverse(_x: T) -> T {
+ unreachable!()
+}
+
+/// Counts the leading zeros of each element.
+///
+/// `T` must be a vector of integers.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_ctlz(_x: T) -> T {
+ unreachable!()
+}
+
+/// Counts the number of ones in each element.
+///
+/// `T` must be a vector of integers.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_ctpop(_x: T) -> T {
+ unreachable!()
+}
+
+/// Counts the trailing zeros of each element.
+///
+/// `T` must be a vector of integers.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_cttz(_x: T) -> T {
+ unreachable!()
+}
+
+/// Rounds up each element to the next highest integer-valued float.
+///
+/// `T` must be a vector of floats.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_ceil(_x: T) -> T {
+ unreachable!()
+}
+
+/// Rounds down each element to the next lowest integer-valued float.
+///
+/// `T` must be a vector of floats.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_floor(_x: T) -> T {
+ unreachable!()
+}
+
+/// Rounds each element to the closest integer-valued float.
+/// Ties are resolved by rounding away from 0.
+///
+/// `T` must be a vector of floats.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_round(_x: T) -> T {
+ unreachable!()
+}
+
+/// Returns the integer part of each element as an integer-valued float.
+/// In other words, non-integer values are truncated towards zero.
+///
+/// `T` must be a vector of floats.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_trunc(_x: T) -> T {
+ unreachable!()
+}
+
+/// Takes the square root of each element.
+///
+/// `T` must be a vector of floats.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_fsqrt(_x: T) -> T {
+ unreachable!()
+}
+
+/// Computes `(x*y) + z` for each element, but without any intermediate rounding.
+///
+/// `T` must be a vector of floats.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_fma(_x: T, _y: T, _z: T) -> T {
+ unreachable!()
+}
+
+/// Computes `(x*y) + z` for each element, non-deterministically executing either
+/// a fused multiply-add or two operations with rounding of the intermediate result.
+///
+/// The operation is fused if the code generator determines that target instruction
+/// set has support for a fused operation, and that the fused operation is more efficient
+/// than the equivalent, separate pair of mul and add instructions. It is unspecified
+/// whether or not a fused operation is selected, and that may depend on optimization
+/// level and context, for example. It may even be the case that some SIMD lanes get fused
+/// and others do not.
+///
+/// `T` must be a vector of floats.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_relaxed_fma(_x: T, _y: T, _z: T) -> T {
+ unreachable!()
+}
+
+// Computes the sine of each element.
+///
+/// `T` must be a vector of floats.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_fsin(_a: T) -> T {
+ unreachable!()
+}
+
+// Computes the cosine of each element.
+///
+/// `T` must be a vector of floats.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_fcos(_a: T) -> T {
+ unreachable!()
+}
+
+// Computes the exponential function of each element.
+///
+/// `T` must be a vector of floats.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_fexp(_a: T) -> T {
+ unreachable!()
+}
+
+// Computes 2 raised to the power of each element.
+///
+/// `T` must be a vector of floats.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_fexp2(_a: T) -> T {
+ unreachable!()
+}
+
+// Computes the base 10 logarithm of each element.
+///
+/// `T` must be a vector of floats.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_flog10(_a: T) -> T {
+ unreachable!()
+}
+
+// Computes the base 2 logarithm of each element.
+///
+/// `T` must be a vector of floats.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_flog2(_a: T) -> T {
+ unreachable!()
+}
+
+// Computes the natural logarithm of each element.
+///
+/// `T` must be a vector of floats.
+#[rustc_intrinsic]
+#[rustc_intrinsic_must_be_overridden]
+#[rustc_nounwind]
+pub unsafe fn simd_flog(_a: T) -> T {
+ unreachable!()
}
diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs
index 231c8712ebd5..1fa13e95e687 100644
--- a/library/std/src/io/mod.rs
+++ b/library/std/src/io/mod.rs
@@ -3252,18 +3252,26 @@ impl Iterator for Lines {
}
}
-/// Create anonymous pipe that is close-on-exec and blocking.
+/// Create an anonymous pipe that is close-on-exec and blocking.
///
/// # Behavior
///
-/// A pipe is a synchronous, unidirectional data channel between two or more processes, like an
-/// interprocess [`mpsc`](crate::sync::mpsc) provided by the OS. In particular:
+/// A pipe is a one-way data channel provided by the OS, which works across processes. A pipe is
+/// typically used to communicate between two or more separate processes, as there are better,
+/// faster ways to communicate within a single process.
+///
+/// In particular:
///
/// * A read on a [`PipeReader`] blocks until the pipe is non-empty.
/// * A write on a [`PipeWriter`] blocks when the pipe is full.
/// * When all copies of a [`PipeWriter`] are closed, a read on the corresponding [`PipeReader`]
/// returns EOF.
-/// * [`PipeReader`] can be shared, but only one process will consume the data in the pipe.
+/// * [`PipeWriter`] can be shared, and multiple processes or threads can write to it at once, but
+/// writes (above a target-specific threshold) may have their data interleaved.
+/// * [`PipeReader`] can be shared, and multiple processes or threads can read it at once. Any
+/// given byte will only get consumed by one reader. There are no guarantees about data
+/// interleaving.
+/// * Portable applications cannot assume any atomicity of messages larger than a single byte.
///
/// # Capacity
///
@@ -3301,8 +3309,6 @@ impl Iterator for Lines {
/// # Ok(())
/// # }
/// ```
-/// [pipe]: https://man7.org/linux/man-pages/man2/pipe.2.html
-/// [CreatePipe]: https://learn.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-createpipe
/// [man page]: https://man7.org/linux/man-pages/man7/pipe.7.html
#[unstable(feature = "anonymous_pipe", issue = "127154")]
#[inline]
@@ -3310,12 +3316,12 @@ pub fn pipe() -> Result<(PipeReader, PipeWriter)> {
pipe_inner().map(|(reader, writer)| (PipeReader(reader), PipeWriter(writer)))
}
-/// Read end of the anonymous pipe.
+/// Read end of an anonymous pipe.
#[unstable(feature = "anonymous_pipe", issue = "127154")]
#[derive(Debug)]
pub struct PipeReader(pub(crate) AnonPipe);
-/// Write end of the anonymous pipe.
+/// Write end of an anonymous pipe.
#[unstable(feature = "anonymous_pipe", issue = "127154")]
#[derive(Debug)]
pub struct PipeWriter(pub(crate) AnonPipe);
diff --git a/library/std/src/sys/pal/unix/thread.rs b/library/std/src/sys/pal/unix/thread.rs
index f657f82e6e36..356669980c7d 100644
--- a/library/std/src/sys/pal/unix/thread.rs
+++ b/library/std/src/sys/pal/unix/thread.rs
@@ -130,7 +130,12 @@ impl Thread {
}
}
- #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly"))]
+ #[cfg(any(
+ target_os = "linux",
+ target_os = "freebsd",
+ target_os = "dragonfly",
+ target_os = "nuttx"
+ ))]
pub fn set_name(name: &CStr) {
unsafe {
cfg_if::cfg_if! {
@@ -139,7 +144,7 @@ impl Thread {
const TASK_COMM_LEN: usize = 16;
let name = truncate_cstr::<{ TASK_COMM_LEN }>(name);
} else {
- // FreeBSD and DragonFly BSD do not enforce length limits.
+ // FreeBSD, DragonFly, FreeBSD and NuttX do not enforce length limits.
}
};
// Available since glibc 2.12, musl 1.1.16, and uClibc 1.0.20 for Linux,
@@ -150,7 +155,7 @@ impl Thread {
}
}
- #[cfg(any(target_os = "openbsd", target_os = "nuttx"))]
+ #[cfg(target_os = "openbsd")]
pub fn set_name(name: &CStr) {
unsafe {
libc::pthread_set_name_np(libc::pthread_self(), name.as_ptr());
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 74923af15558..01a9792f1b37 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -1310,9 +1310,6 @@ def bootstrap(args):
args = [build.bootstrap_binary()]
args.extend(sys.argv[1:])
env = os.environ.copy()
- # The Python process ID is used when creating a Windows job object
- # (see src\bootstrap\src\utils\job.rs)
- env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
env["BOOTSTRAP_PYTHON"] = sys.executable
run(args, env=env, verbose=build.verbose, is_bootstrap=True)
diff --git a/src/bootstrap/src/bin/main.rs b/src/bootstrap/src/bin/main.rs
index b65527741952..8ebd6b8aa54c 100644
--- a/src/bootstrap/src/bin/main.rs
+++ b/src/bootstrap/src/bin/main.rs
@@ -57,7 +57,9 @@ fn main() {
}
err => {
drop(err);
- if let Ok(pid) = pid {
+ // #135972: We can reach this point when the lock has been taken,
+ // but the locker has not yet written its PID to the file
+ if let Some(pid) = pid.ok().filter(|pid| !pid.is_empty()) {
println!("WARNING: build directory locked by process {pid}, waiting for lock");
} else {
println!("WARNING: build directory locked, waiting for lock");
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index 0d3ab6ad97d3..99b033db115c 100644
--- a/src/bootstrap/src/core/build_steps/test.rs
+++ b/src/bootstrap/src/core/build_steps/test.rs
@@ -1842,12 +1842,19 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
let mut hostflags = flags.clone();
hostflags.push(format!("-Lnative={}", builder.test_helpers_out(compiler.host).display()));
hostflags.extend(linker_flags(builder, compiler.host, LldThreads::No));
- for flag in hostflags {
- cmd.arg("--host-rustcflags").arg(flag);
- }
let mut targetflags = flags;
targetflags.push(format!("-Lnative={}", builder.test_helpers_out(target).display()));
+
+ // FIXME: on macOS, we get linker warnings about duplicate `-lm` flags. We should investigate why this happens.
+ if suite == "ui-fulldeps" && target.ends_with("darwin") {
+ hostflags.push("-Alinker_messages".into());
+ targetflags.push("-Alinker_messages".into());
+ }
+
+ for flag in hostflags {
+ cmd.arg("--host-rustcflags").arg(flag);
+ }
for flag in targetflags {
cmd.arg("--target-rustcflags").arg(flag);
}
@@ -3554,6 +3561,8 @@ impl Step for CodegenGCC {
let mut cargo = build_cargo();
cargo
+ // cg_gcc's build system ignores RUSTFLAGS. pass some flags through CG_RUSTFLAGS instead.
+ .env("CG_RUSTFLAGS", "-Alinker-messages")
.arg("--")
.arg("test")
.arg("--use-system-gcc")
diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs
index 6b792108784d..d418237a5689 100644
--- a/src/bootstrap/src/core/builder/cargo.rs
+++ b/src/bootstrap/src/core/builder/cargo.rs
@@ -273,6 +273,13 @@ impl Cargo {
self.rustflags.arg("-Clink-arg=-gz");
}
+ // Ignore linker warnings for now. These are complicated to fix and don't affect the build.
+ // FIXME: we should really investigate these...
+ // cfg(bootstrap)
+ if compiler.stage != 0 {
+ self.rustflags.arg("-Alinker-messages");
+ }
+
// Throughout the build Cargo can execute a number of build scripts
// compiling C/C++ code and we need to pass compilers, archivers, flags, etc
// obtained previously to those build scripts.
diff --git a/src/bootstrap/src/utils/job.rs b/src/bootstrap/src/utils/job.rs
index fb69d331d27e..10efed130d62 100644
--- a/src/bootstrap/src/utils/job.rs
+++ b/src/bootstrap/src/utils/job.rs
@@ -42,9 +42,9 @@ pub unsafe fn setup(build: &mut crate::Build) {
#[cfg(windows)]
mod for_windows {
use std::ffi::c_void;
- use std::{env, io, mem};
+ use std::{io, mem};
- use windows::Win32::Foundation::{CloseHandle, DUPLICATE_SAME_ACCESS, DuplicateHandle, HANDLE};
+ use windows::Win32::Foundation::CloseHandle;
use windows::Win32::System::Diagnostics::Debug::{
SEM_NOGPFAULTERRORBOX, SetErrorMode, THREAD_ERROR_MODE,
};
@@ -53,9 +53,7 @@ mod for_windows {
JOB_OBJECT_LIMIT_PRIORITY_CLASS, JOBOBJECT_EXTENDED_LIMIT_INFORMATION,
JobObjectExtendedLimitInformation, SetInformationJobObject,
};
- use windows::Win32::System::Threading::{
- BELOW_NORMAL_PRIORITY_CLASS, GetCurrentProcess, OpenProcess, PROCESS_DUP_HANDLE,
- };
+ use windows::Win32::System::Threading::{BELOW_NORMAL_PRIORITY_CLASS, GetCurrentProcess};
use windows::core::PCWSTR;
use crate::Build;
@@ -95,49 +93,8 @@ mod for_windows {
return;
}
- // If we've got a parent process (e.g., the python script that called us)
- // then move ownership of this job object up to them. That way if the python
- // script is killed (e.g., via ctrl-c) then we'll all be torn down.
- //
- // If we don't have a parent (e.g., this was run directly) then we
- // intentionally leak the job object handle. When our process exits
+ // Note: we intentionally leak the job object handle. When our process exits
// (normally or abnormally) it will close the handle implicitly, causing all
// processes in the job to be cleaned up.
- let pid = match env::var("BOOTSTRAP_PARENT_ID") {
- Ok(s) => s,
- Err(..) => return,
- };
-
- let parent = match OpenProcess(PROCESS_DUP_HANDLE, false, pid.parse().unwrap()).ok() {
- Some(parent) => parent,
- _ => {
- // If we get a null parent pointer here, it is possible that either
- // we have an invalid pid or the parent process has been closed.
- // Since the first case rarely happens
- // (only when wrongly setting the environmental variable),
- // it might be better to improve the experience of the second case
- // when users have interrupted the parent process and we haven't finish
- // duplicating the handle yet.
- return;
- }
- };
-
- let mut parent_handle = HANDLE::default();
- // If this fails, well at least we tried! An example of DuplicateHandle
- // failing in the past has been when the wrong python2 package spawned this
- // build system (e.g., the `python2` package in MSYS instead of
- // `mingw-w64-x86_64-python2`). Not sure why it failed, but the "failure
- // mode" here is that we only clean everything up when the build system
- // dies, not when the python parent does, so not too bad.
- let _ = DuplicateHandle(
- GetCurrentProcess(),
- job,
- parent,
- &mut parent_handle,
- 0,
- false,
- DUPLICATE_SAME_ACCESS,
- );
- CloseHandle(parent).ok();
}
}
diff --git a/src/build_helper/src/metrics.rs b/src/build_helper/src/metrics.rs
index 2d0c66a8f333..538c33e9b159 100644
--- a/src/build_helper/src/metrics.rs
+++ b/src/build_helper/src/metrics.rs
@@ -16,6 +16,7 @@ pub struct JsonInvocation {
//
// This is necessary to easily correlate this invocation with logs or other data.
pub start_time: u64,
+ #[serde(deserialize_with = "null_as_f64_nan")]
pub duration_including_children_sec: f64,
pub children: Vec,
}
@@ -28,6 +29,7 @@ pub enum JsonNode {
type_: String,
debug_repr: String,
+ #[serde(deserialize_with = "null_as_f64_nan")]
duration_excluding_children_sec: f64,
system_stats: JsonStepSystemStats,
@@ -88,5 +90,11 @@ pub struct JsonInvocationSystemStats {
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub struct JsonStepSystemStats {
+ #[serde(deserialize_with = "null_as_f64_nan")]
pub cpu_utilization_percent: f64,
}
+
+fn null_as_f64_nan<'de, D: serde::Deserializer<'de>>(d: D) -> Result {
+ use serde::Deserialize as _;
+ Option::::deserialize(d).map(|f| f.unwrap_or(f64::NAN))
+}
diff --git a/src/doc/rustc/src/check-cfg/cargo-specifics.md b/src/doc/rustc/src/check-cfg/cargo-specifics.md
index bd4bebbc874a..371bbd26e943 100644
--- a/src/doc/rustc/src/check-cfg/cargo-specifics.md
+++ b/src/doc/rustc/src/check-cfg/cargo-specifics.md
@@ -13,6 +13,8 @@ the `unexpected_cfgs` lint and `--check-cfg` flag. It is not intended to provide
individual details, for that refer to the [`--check-cfg` documentation](../check-cfg.md) and
to the [Cargo book](../../cargo/index.html).
+> The full list of well known cfgs (aka builtins) can be found under [Checking conditional configurations / Well known names and values](../check-cfg.md#well-known-names-and-values).
+
## Cargo feature
*See the [`[features]` section in the Cargo book][cargo-features] for more details.*
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index ad67c2ba2453..0437ebb58576 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -178,7 +178,7 @@ pub(crate) fn new_dcx(
Box::new(
JsonEmitter::new(
Box::new(io::BufWriter::new(io::stderr())),
- source_map,
+ Some(source_map),
fallback_bundle,
pretty,
json_rendered,
diff --git a/src/tools/cargo b/src/tools/cargo
index 045bf21b36a2..cecde95c119a 160000
--- a/src/tools/cargo
+++ b/src/tools/cargo
@@ -1 +1 @@
-Subproject commit 045bf21b36a2e1f3ed85e38278d1c3cc4305e134
+Subproject commit cecde95c119a456c30e57d3e4b31fff5a7d83df4
diff --git a/src/tools/compiletest/src/runtest/run_make.rs b/src/tools/compiletest/src/runtest/run_make.rs
index 8a49d6305352..7ef16e4a9667 100644
--- a/src/tools/compiletest/src/runtest/run_make.rs
+++ b/src/tools/compiletest/src/runtest/run_make.rs
@@ -414,6 +414,8 @@ impl TestCx<'_> {
// Provide path to checkout root. This is the top-level directory containing
// rust-lang/rust checkout.
.env("SOURCE_ROOT", &source_root)
+ // Path to the build directory. This is usually the same as `source_root.join("build").join("host")`.
+ .env("BUILD_ROOT", &build_root)
// Provide path to stage-corresponding rustc.
.env("RUSTC", &self.config.rustc_path)
// Provide the directory to libraries that are needed to run the *compiler*. This is not
diff --git a/src/tools/miri/tests/fail/rustc-error2.rs b/src/tools/miri/tests/fail/rustc-error2.rs
index fd2c53933856..ec42fd17e892 100644
--- a/src/tools/miri/tests/fail/rustc-error2.rs
+++ b/src/tools/miri/tests/fail/rustc-error2.rs
@@ -4,7 +4,7 @@ struct Struct(T);
impl std::ops::Deref for Struct {
type Target = dyn Fn(T);
fn deref(&self) -> &assert_mem_uninitialized_valid::Target {
- //~^ERROR: undeclared crate or module
+ //~^ERROR: use of unresolved module or unlinked crate
unimplemented!()
}
}
diff --git a/src/tools/miri/tests/fail/rustc-error2.stderr b/src/tools/miri/tests/fail/rustc-error2.stderr
index cfbf305d3bbf..62e3f392ea9d 100644
--- a/src/tools/miri/tests/fail/rustc-error2.stderr
+++ b/src/tools/miri/tests/fail/rustc-error2.stderr
@@ -1,8 +1,10 @@
-error[E0433]: failed to resolve: use of undeclared crate or module `assert_mem_uninitialized_valid`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `assert_mem_uninitialized_valid`
--> tests/fail/rustc-error2.rs:LL:CC
|
LL | fn deref(&self) -> &assert_mem_uninitialized_valid::Target {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `assert_mem_uninitialized_valid`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `assert_mem_uninitialized_valid`
+ |
+ = help: you might be missing a crate named `assert_mem_uninitialized_valid`
error: aborting due to 1 previous error
diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs
index ffd4ca22a008..7316244b3841 100644
--- a/src/tools/run-make-support/src/lib.rs
+++ b/src/tools/run-make-support/src/lib.rs
@@ -90,7 +90,7 @@ pub use artifact_names::{
/// Path-related helpers.
pub use path_helpers::{
cwd, filename_contains, filename_not_in_denylist, has_extension, has_prefix, has_suffix,
- not_contains, path, shallow_find_files, source_root,
+ not_contains, path, shallow_find_files, build_root, source_root,
};
/// Helpers for scoped test execution where certain properties are attempted to be maintained.
diff --git a/src/tools/run-make-support/src/path_helpers.rs b/src/tools/run-make-support/src/path_helpers.rs
index 87901793a921..1c59f2feea4c 100644
--- a/src/tools/run-make-support/src/path_helpers.rs
+++ b/src/tools/run-make-support/src/path_helpers.rs
@@ -34,6 +34,12 @@ pub fn source_root() -> PathBuf {
env_var("SOURCE_ROOT").into()
}
+/// Path to the build directory root.
+#[must_use]
+pub fn build_root() -> PathBuf {
+ env_var("BUILD_ROOT").into()
+}
+
/// Browse the directory `path` non-recursively and return all files which respect the parameters
/// outlined by `closure`.
#[track_caller]
diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs
index 59e0042e5c9b..faa0db27b2b0 100644
--- a/src/tools/tidy/src/deps.rs
+++ b/src/tools/tidy/src/deps.rs
@@ -253,6 +253,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
"bitflags",
"blake3",
"block-buffer",
+ "bstr",
"byteorder", // via ruzstd in object in thorin-dwp
"cc",
"cfg-if",
diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt
index 0e5a7458b68c..5865664fc894 100644
--- a/src/tools/tidy/src/issues.txt
+++ b/src/tools/tidy/src/issues.txt
@@ -409,7 +409,6 @@ ui/closure_context/issue-26046-fn-once.rs
ui/closure_context/issue-42065.rs
ui/closures/2229_closure_analysis/issue-118144.rs
ui/closures/2229_closure_analysis/issue-87378.rs
-ui/closures/2229_closure_analysis/issue-87987.rs
ui/closures/2229_closure_analysis/issue-88118-2.rs
ui/closures/2229_closure_analysis/issue-88476.rs
ui/closures/2229_closure_analysis/issue-89606.rs
diff --git a/tests/codegen/optimize-attr-1.rs b/tests/codegen/optimize-attr-1.rs
index 3aee44791e0e..db6bdcf9a8b9 100644
--- a/tests/codegen/optimize-attr-1.rs
+++ b/tests/codegen/optimize-attr-1.rs
@@ -37,11 +37,23 @@ pub fn speed() -> i32 {
4 + 4
}
+// CHECK-LABEL: define{{.*}}i32 @none
+// CHECK-SAME: [[NONE_ATTRS:#[0-9]+]]
+// SIZE-OPT: alloca
+// SPEED-OPT: alloca
+#[no_mangle]
+#[optimize(none)]
+pub fn none() -> i32 {
+ let arr = [0, 1, 2, 3, 4];
+ arr[4]
+}
+
// NO-OPT-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}}
// SPEED-OPT-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}}
// SIZE-OPT-DAG: attributes [[NOTHING_ATTRS]] = {{.*}}optsize{{.*}}
// SIZE-OPT-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}}
+// CHECK-DAG: attributes [[NONE_ATTRS]] = {{.*}}noinline{{.*}}optnone{{.*}}
-// SIZE-OPT: attributes [[SPEED_ATTRS]]
+// SIZE-OPT-DAG: attributes [[SPEED_ATTRS]]
// SIZE-OPT-NOT: minsize
// SIZE-OPT-NOT: optsize
diff --git a/tests/mir-opt/optimize_none.rs b/tests/mir-opt/optimize_none.rs
new file mode 100644
index 000000000000..a5b541bd2b62
--- /dev/null
+++ b/tests/mir-opt/optimize_none.rs
@@ -0,0 +1,32 @@
+//@ revisions: NO-OPT SPEED-OPT
+//@[NO-OPT] compile-flags: -Copt-level=0
+//@[SPEED-OPT] compile-flags: -Copt-level=3 -Coverflow-checks=y
+
+#![feature(optimize_attribute)]
+
+#[optimize(none)]
+pub fn add_noopt() -> i32 {
+ // CHECK-LABEL: fn add_noopt(
+ // CHECK: AddWithOverflow(const 1_i32, const 2_i32);
+ // CHECK-NEXT: assert
+ 1 + 2
+}
+
+#[optimize(none)]
+pub fn const_branch() -> i32 {
+ // CHECK-LABEL: fn const_branch(
+ // CHECK: switchInt(const true) -> [0: [[FALSE:bb[0-9]+]], otherwise: [[TRUE:bb[0-9]+]]];
+ // CHECK-NEXT: }
+ // CHECK: [[FALSE]]: {
+ // CHECK-NEXT: _0 = const 0
+ // CHECK-NEXT: goto
+ // CHECK-NEXT: }
+ // CHECK: [[TRUE]]: {
+ // CHECK-NEXT: _0 = const 1
+ // CHECK-NEXT: goto
+ // CHECK-NEXT: }
+
+ if true { 1 } else { 0 }
+}
+
+fn main() {}
diff --git a/tests/run-make/linker-warning/fake-linker.sh b/tests/run-make/linker-warning/fake-linker.sh
new file mode 100755
index 000000000000..ed4d472c3bfb
--- /dev/null
+++ b/tests/run-make/linker-warning/fake-linker.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+code=0
+while ! [ $# = 0 ]; do
+ case "$1" in
+ run_make_info) echo "foo"
+ ;;
+ run_make_warn) echo "warning: bar" >&2
+ ;;
+ run_make_error) echo "error: baz" >&2; code=1
+ ;;
+ *) ;; # rustc passes lots of args we don't care about
+ esac
+ shift
+done
+
+exit $code
diff --git a/tests/run-make/linker-warning/rmake.rs b/tests/run-make/linker-warning/rmake.rs
index 4d21c5ea5690..1bd099d2aee5 100644
--- a/tests/run-make/linker-warning/rmake.rs
+++ b/tests/run-make/linker-warning/rmake.rs
@@ -1,8 +1,19 @@
-use run_make_support::{Rustc, rustc};
+use run_make_support::{Rustc, diff, regex, rustc};
fn run_rustc() -> Rustc {
let mut rustc = rustc();
- rustc.arg("main.rs").output("main").linker("./fake-linker");
+ rustc
+ .arg("main.rs")
+ // NOTE: `link-self-contained` can vary depending on config.toml.
+ // Make sure we use a consistent value.
+ .arg("-Clink-self-contained=-linker")
+ .arg("-Zunstable-options")
+ .output("main")
+ .linker("./fake-linker");
+ if run_make_support::target() == "x86_64-unknown-linux-gnu" {
+ // The value of `rust.lld` is different between CI and locally. Override it explicitly.
+ rustc.arg("-Clinker-flavor=gnu-cc");
+ }
rustc
}
@@ -10,19 +21,73 @@ fn main() {
// first, compile our linker
rustc().arg("fake-linker.rs").output("fake-linker").run();
+ // Run rustc with our fake linker, and make sure it shows warnings
+ let warnings = run_rustc().link_arg("run_make_warn").run();
+ warnings.assert_stderr_contains("warning: linker stderr: bar");
+
+ // Make sure it shows stdout
+ run_rustc()
+ .link_arg("run_make_info")
+ .run()
+ .assert_stderr_contains("warning: linker stdout: foo");
+
+ // Make sure we short-circuit this new path if the linker exits with an error
+ // (so the diagnostic is less verbose)
+ run_rustc().link_arg("run_make_error").run_fail().assert_stderr_contains("note: error: baz");
+
// Make sure we don't show the linker args unless `--verbose` is passed
- run_rustc()
- .link_arg("run_make_error")
- .verbose()
- .run_fail()
- .assert_stderr_contains_regex("fake-linker.*run_make_error")
+ let out = run_rustc().link_arg("run_make_error").verbose().run_fail();
+ out.assert_stderr_contains_regex("fake-linker.*run_make_error")
.assert_stderr_not_contains("object files omitted")
+ .assert_stderr_contains(r".rcgu.o")
.assert_stderr_contains_regex(r"lib(/|\\\\)libstd");
- run_rustc()
- .link_arg("run_make_error")
- .run_fail()
- .assert_stderr_contains("fake-linker")
+
+ let out = run_rustc().link_arg("run_make_error").run_fail();
+ out.assert_stderr_contains("fake-linker")
.assert_stderr_contains("object files omitted")
.assert_stderr_contains_regex(r"\{")
+ .assert_stderr_not_contains(r".rcgu.o")
.assert_stderr_not_contains_regex(r"lib(/|\\\\)libstd");
+
+ // FIXME: we should have a version of this for mac and windows
+ if run_make_support::target() == "x86_64-unknown-linux-gnu" {
+ diff()
+ .expected_file("short-error.txt")
+ .actual_text("(linker error)", out.stderr())
+ .normalize(r#"/rustc[^/]*/"#, "/rustc/")
+ .normalize(
+ regex::escape(run_make_support::build_root().to_str().unwrap()),
+ "/build-root",
+ )
+ .run();
+ }
+
+ // Make sure we show linker warnings even across `-Z no-link`
+ rustc()
+ .arg("-Zno-link")
+ .input("-")
+ .stdin_buf("#![deny(linker_messages)] \n fn main() {}")
+ .run()
+ .assert_stderr_equals("");
+ rustc()
+ .arg("-Zlink-only")
+ .arg("rust_out.rlink")
+ .linker("./fake-linker")
+ .link_arg("run_make_warn")
+ .run_fail()
+ // NOTE: the error message here is quite bad (we don't have a source
+ // span, but still try to print the lint source). But `-Z link-only` is
+ // unstable and this still shows the linker warning itself so this is
+ // probably good enough.
+ .assert_stderr_contains("linker stderr: bar");
+
+ // Same thing, but with json output.
+ rustc()
+ .error_format("json")
+ .arg("-Zlink-only")
+ .arg("rust_out.rlink")
+ .linker("./fake-linker")
+ .link_arg("run_make_warn")
+ .run_fail()
+ .assert_stderr_contains(r#""$message_type":"diagnostic""#);
}
diff --git a/tests/run-make/linker-warning/short-error.txt b/tests/run-make/linker-warning/short-error.txt
new file mode 100644
index 000000000000..dd3b742bbfd5
--- /dev/null
+++ b/tests/run-make/linker-warning/short-error.txt
@@ -0,0 +1,9 @@
+error: linking with `./fake-linker` failed: exit status: 1
+ |
+ = note: "./fake-linker" "-m64" "/tmp/rustc/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,liballoc-*,librustc_std_workspace_core-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/build-root/test/run-make/linker-warning/rmake_out" "-L" "/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "main" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "run_make_error"
+ = note: some arguments are omitted. use `--verbose` to show all linker arguments
+ = note: error: baz
+
+
+error: aborting due to 1 previous error
+
diff --git a/tests/run-make/rust-lld-by-default-beta-stable/rmake.rs b/tests/run-make/rust-lld-by-default-beta-stable/rmake.rs
index 2417a4274e4a..d2f1e8b253a7 100644
--- a/tests/run-make/rust-lld-by-default-beta-stable/rmake.rs
+++ b/tests/run-make/rust-lld-by-default-beta-stable/rmake.rs
@@ -12,11 +12,7 @@ use run_make_support::rustc;
fn main() {
// A regular compilation should not use rust-lld by default. We'll check that by asking the
// linker to display its version number with a link-arg.
- let output = rustc()
- .env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
- .link_arg("-Wl,-v")
- .input("main.rs")
- .run();
+ let output = rustc().link_arg("-Wl,-v").input("main.rs").run();
assert!(
!find_lld_version_in_logs(output.stderr_utf8()),
"the LLD version string should not be present in the output logs:\n{}",
@@ -25,6 +21,7 @@ fn main() {
}
fn find_lld_version_in_logs(stderr: String) -> bool {
- let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
+ let lld_version_re =
+ Regex::new(r"^warning: linker stdout: LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
stderr.lines().any(|line| lld_version_re.is_match(line.trim()))
}
diff --git a/tests/run-make/rust-lld-by-default-nightly/rmake.rs b/tests/run-make/rust-lld-by-default-nightly/rmake.rs
index 02bbe8227f03..a25a69b859ba 100644
--- a/tests/run-make/rust-lld-by-default-nightly/rmake.rs
+++ b/tests/run-make/rust-lld-by-default-nightly/rmake.rs
@@ -12,11 +12,7 @@ use run_make_support::rustc;
fn main() {
// A regular compilation should use rust-lld by default. We'll check that by asking the linker
// to display its version number with a link-arg.
- let output = rustc()
- .env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
- .link_arg("-Wl,-v")
- .input("main.rs")
- .run();
+ let output = rustc().link_arg("-Wl,-v").input("main.rs").run();
assert!(
find_lld_version_in_logs(output.stderr_utf8()),
"the LLD version string should be present in the output logs:\n{}",
@@ -24,12 +20,7 @@ fn main() {
);
// But it can still be disabled by turning the linker feature off.
- let output = rustc()
- .env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
- .link_arg("-Wl,-v")
- .arg("-Zlinker-features=-lld")
- .input("main.rs")
- .run();
+ let output = rustc().link_arg("-Wl,-v").arg("-Zlinker-features=-lld").input("main.rs").run();
assert!(
!find_lld_version_in_logs(output.stderr_utf8()),
"the LLD version string should not be present in the output logs:\n{}",
@@ -38,6 +29,7 @@ fn main() {
}
fn find_lld_version_in_logs(stderr: String) -> bool {
- let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
+ let lld_version_re =
+ Regex::new(r"^warning: linker stdout: LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
stderr.lines().any(|line| lld_version_re.is_match(line.trim()))
}
diff --git a/tests/run-make/rust-lld-custom-target/rmake.rs b/tests/run-make/rust-lld-custom-target/rmake.rs
index a6f7c33793af..a6f936ba6e5c 100644
--- a/tests/run-make/rust-lld-custom-target/rmake.rs
+++ b/tests/run-make/rust-lld-custom-target/rmake.rs
@@ -15,7 +15,6 @@ fn main() {
// Compile to a custom target spec with rust-lld enabled by default. We'll check that by asking
// the linker to display its version number with a link-arg.
let output = rustc()
- .env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
.crate_type("cdylib")
.target("custom-target.json")
.link_arg("-Wl,-v")
@@ -29,7 +28,6 @@ fn main() {
// But it can also be disabled via linker features.
let output = rustc()
- .env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
.crate_type("cdylib")
.target("custom-target.json")
.arg("-Zlinker-features=-lld")
@@ -44,6 +42,7 @@ fn main() {
}
fn find_lld_version_in_logs(stderr: String) -> bool {
- let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
+ let lld_version_re =
+ Regex::new(r"^warning: linker stdout: LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
stderr.lines().any(|line| lld_version_re.is_match(line.trim()))
}
diff --git a/tests/run-make/rust-lld/rmake.rs b/tests/run-make/rust-lld/rmake.rs
index 1f311af1ed59..76b15ab1799b 100644
--- a/tests/run-make/rust-lld/rmake.rs
+++ b/tests/run-make/rust-lld/rmake.rs
@@ -14,7 +14,6 @@ fn main() {
// Opt-in to lld and the self-contained linker, to link with rust-lld. We'll check that by
// asking the linker to display its version number with a link-arg.
let output = rustc()
- .env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
.arg("-Zlinker-features=+lld")
.arg("-Clink-self-contained=+linker")
.arg("-Zunstable-options")
@@ -28,12 +27,8 @@ fn main() {
);
// It should not be used when we explicitly opt-out of lld.
- let output = rustc()
- .env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
- .link_arg(linker_version_flag)
- .arg("-Zlinker-features=-lld")
- .input("main.rs")
- .run();
+ let output =
+ rustc().link_arg(linker_version_flag).arg("-Zlinker-features=-lld").input("main.rs").run();
assert!(
!find_lld_version_in_logs(output.stderr_utf8()),
"the LLD version string should not be present in the output logs:\n{}",
@@ -43,7 +38,6 @@ fn main() {
// While we're here, also check that the last linker feature flag "wins" when passed multiple
// times to rustc.
let output = rustc()
- .env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
.link_arg(linker_version_flag)
.arg("-Clink-self-contained=+linker")
.arg("-Zunstable-options")
@@ -60,6 +54,7 @@ fn main() {
}
fn find_lld_version_in_logs(stderr: String) -> bool {
- let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
+ let lld_version_re =
+ Regex::new(r"^warning: linker std(out|err): LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap();
stderr.lines().any(|line| lld_version_re.is_match(line.trim()))
}
diff --git a/tests/rustdoc-ui/ice-unresolved-import-100241.stderr b/tests/rustdoc-ui/ice-unresolved-import-100241.stderr
index 2eebedba9a5e..a82847d381c5 100644
--- a/tests/rustdoc-ui/ice-unresolved-import-100241.stderr
+++ b/tests/rustdoc-ui/ice-unresolved-import-100241.stderr
@@ -2,9 +2,9 @@ error[E0432]: unresolved import `inner`
--> $DIR/ice-unresolved-import-100241.rs:9:13
|
LL | pub use inner::S;
- | ^^^^^ you might be missing crate `inner`
+ | ^^^^^ use of unresolved module or unlinked crate `inner`
|
-help: consider importing the `inner` crate
+help: you might be missing a crate named `inner`, add it to your project and import it in your code
|
LL + extern crate inner;
|
diff --git a/tests/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr b/tests/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr
index e68943192130..dcdd230c25a1 100644
--- a/tests/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr
+++ b/tests/rustdoc-ui/intra-doc/unresolved-import-recovery.stderr
@@ -1,10 +1,10 @@
-error[E0433]: failed to resolve: you might be missing crate `unresolved_crate`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `unresolved_crate`
--> $DIR/unresolved-import-recovery.rs:3:5
|
LL | use unresolved_crate::module::Name;
- | ^^^^^^^^^^^^^^^^ you might be missing crate `unresolved_crate`
+ | ^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `unresolved_crate`
|
-help: consider importing the `unresolved_crate` crate
+help: you might be missing a crate named `unresolved_crate`, add it to your project and import it in your code
|
LL + extern crate unresolved_crate;
|
diff --git a/tests/rustdoc-ui/issues/issue-61732.rs b/tests/rustdoc-ui/issues/issue-61732.rs
index 3969ab92c32e..d5d9ad5e4637 100644
--- a/tests/rustdoc-ui/issues/issue-61732.rs
+++ b/tests/rustdoc-ui/issues/issue-61732.rs
@@ -1,4 +1,4 @@
// This previously triggered an ICE.
pub(in crate::r#mod) fn main() {}
-//~^ ERROR failed to resolve: you might be missing crate `r#mod`
+//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `r#mod`
diff --git a/tests/rustdoc-ui/issues/issue-61732.stderr b/tests/rustdoc-ui/issues/issue-61732.stderr
index 0aa7d558c307..c4e6997ab74d 100644
--- a/tests/rustdoc-ui/issues/issue-61732.stderr
+++ b/tests/rustdoc-ui/issues/issue-61732.stderr
@@ -1,10 +1,10 @@
-error[E0433]: failed to resolve: you might be missing crate `r#mod`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `r#mod`
--> $DIR/issue-61732.rs:3:15
|
LL | pub(in crate::r#mod) fn main() {}
- | ^^^^^ you might be missing crate `r#mod`
+ | ^^^^^ use of unresolved module or unlinked crate `r#mod`
|
-help: consider importing the `r#mod` crate
+help: you might be missing a crate named `r#mod`, add it to your project and import it in your code
|
LL + extern crate r#mod;
|
diff --git a/tests/ui/attributes/check-builtin-attr-ice.stderr b/tests/ui/attributes/check-builtin-attr-ice.stderr
index 5a27da565a85..06a4769b2b42 100644
--- a/tests/ui/attributes/check-builtin-attr-ice.stderr
+++ b/tests/ui/attributes/check-builtin-attr-ice.stderr
@@ -1,20 +1,20 @@
-error[E0433]: failed to resolve: use of undeclared crate or module `should_panic`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `should_panic`
--> $DIR/check-builtin-attr-ice.rs:43:7
|
LL | #[should_panic::skip]
- | ^^^^^^^^^^^^ use of undeclared crate or module `should_panic`
+ | ^^^^^^^^^^^^ use of unresolved module or unlinked crate `should_panic`
-error[E0433]: failed to resolve: use of undeclared crate or module `should_panic`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `should_panic`
--> $DIR/check-builtin-attr-ice.rs:47:7
|
LL | #[should_panic::a::b::c]
- | ^^^^^^^^^^^^ use of undeclared crate or module `should_panic`
+ | ^^^^^^^^^^^^ use of unresolved module or unlinked crate `should_panic`
-error[E0433]: failed to resolve: use of undeclared crate or module `deny`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `deny`
--> $DIR/check-builtin-attr-ice.rs:55:7
|
LL | #[deny::skip]
- | ^^^^ use of undeclared crate or module `deny`
+ | ^^^^ use of unresolved module or unlinked crate `deny`
error: aborting due to 3 previous errors
diff --git a/tests/ui/attributes/check-cfg_attr-ice.stderr b/tests/ui/attributes/check-cfg_attr-ice.stderr
index dbdf32597f7b..bed3150bdc2f 100644
--- a/tests/ui/attributes/check-cfg_attr-ice.stderr
+++ b/tests/ui/attributes/check-cfg_attr-ice.stderr
@@ -17,83 +17,83 @@ LL | #[cfg_attr::no_such_thing]
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
--> $DIR/check-cfg_attr-ice.rs:52:3
|
LL | #[cfg_attr::no_such_thing]
- | ^^^^^^^^ use of undeclared crate or module `cfg_attr`
+ | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
-error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
--> $DIR/check-cfg_attr-ice.rs:55:7
|
LL | #[cfg_attr::no_such_thing]
- | ^^^^^^^^ use of undeclared crate or module `cfg_attr`
+ | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
-error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
--> $DIR/check-cfg_attr-ice.rs:57:17
|
LL | GiveYouUp(#[cfg_attr::no_such_thing] u8),
- | ^^^^^^^^ use of undeclared crate or module `cfg_attr`
+ | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
-error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
--> $DIR/check-cfg_attr-ice.rs:64:11
|
LL | #[cfg_attr::no_such_thing]
- | ^^^^^^^^ use of undeclared crate or module `cfg_attr`
+ | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
-error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
--> $DIR/check-cfg_attr-ice.rs:41:7
|
LL | #[cfg_attr::no_such_thing]
- | ^^^^^^^^ use of undeclared crate or module `cfg_attr`
+ | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
-error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
--> $DIR/check-cfg_attr-ice.rs:43:15
|
LL | fn from(#[cfg_attr::no_such_thing] any_other_guy: AnyOtherGuy) -> This {
- | ^^^^^^^^ use of undeclared crate or module `cfg_attr`
+ | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
-error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
--> $DIR/check-cfg_attr-ice.rs:45:11
|
LL | #[cfg_attr::no_such_thing]
- | ^^^^^^^^ use of undeclared crate or module `cfg_attr`
+ | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
-error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
--> $DIR/check-cfg_attr-ice.rs:32:3
|
LL | #[cfg_attr::no_such_thing]
- | ^^^^^^^^ use of undeclared crate or module `cfg_attr`
+ | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
-error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
--> $DIR/check-cfg_attr-ice.rs:24:3
|
LL | #[cfg_attr::no_such_thing]
- | ^^^^^^^^ use of undeclared crate or module `cfg_attr`
+ | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
-error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
--> $DIR/check-cfg_attr-ice.rs:27:7
|
LL | #[cfg_attr::no_such_thing]
- | ^^^^^^^^ use of undeclared crate or module `cfg_attr`
+ | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
-error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
--> $DIR/check-cfg_attr-ice.rs:16:3
|
LL | #[cfg_attr::no_such_thing]
- | ^^^^^^^^ use of undeclared crate or module `cfg_attr`
+ | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
-error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
--> $DIR/check-cfg_attr-ice.rs:19:7
|
LL | #[cfg_attr::no_such_thing]
- | ^^^^^^^^ use of undeclared crate or module `cfg_attr`
+ | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
-error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `cfg_attr`
--> $DIR/check-cfg_attr-ice.rs:12:3
|
LL | #[cfg_attr::no_such_thing]
- | ^^^^^^^^ use of undeclared crate or module `cfg_attr`
+ | ^^^^^^^^ use of unresolved module or unlinked crate `cfg_attr`
error: aborting due to 15 previous errors
diff --git a/tests/ui/attributes/field-attributes-vis-unresolved.stderr b/tests/ui/attributes/field-attributes-vis-unresolved.stderr
index f8610c08b022..d689b76eaf8b 100644
--- a/tests/ui/attributes/field-attributes-vis-unresolved.stderr
+++ b/tests/ui/attributes/field-attributes-vis-unresolved.stderr
@@ -1,21 +1,21 @@
-error[E0433]: failed to resolve: you might be missing crate `nonexistent`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nonexistent`
--> $DIR/field-attributes-vis-unresolved.rs:17:12
|
LL | pub(in nonexistent) field: u8
- | ^^^^^^^^^^^ you might be missing crate `nonexistent`
+ | ^^^^^^^^^^^ use of unresolved module or unlinked crate `nonexistent`
|
-help: consider importing the `nonexistent` crate
+help: you might be missing a crate named `nonexistent`, add it to your project and import it in your code
|
LL + extern crate nonexistent;
|
-error[E0433]: failed to resolve: you might be missing crate `nonexistent`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nonexistent`
--> $DIR/field-attributes-vis-unresolved.rs:22:12
|
LL | pub(in nonexistent) u8
- | ^^^^^^^^^^^ you might be missing crate `nonexistent`
+ | ^^^^^^^^^^^ use of unresolved module or unlinked crate `nonexistent`
|
-help: consider importing the `nonexistent` crate
+help: you might be missing a crate named `nonexistent`, add it to your project and import it in your code
|
LL + extern crate nonexistent;
|
diff --git a/tests/ui/check-cfg/allow-same-level.rs b/tests/ui/check-cfg/allow-same-level.rs
index ff724174cea5..5eef50e08e21 100644
--- a/tests/ui/check-cfg/allow-same-level.rs
+++ b/tests/ui/check-cfg/allow-same-level.rs
@@ -1,12 +1,24 @@
-// This test check that #[allow(unexpected_cfgs)] doesn't work if put on the same level
+// This test check that #[allow(unexpected_cfgs)] **doesn't work**
+// when put on the same level as the #[cfg] attribute.
+//
+// It should work, but due to interactions between how #[cfg]s are
+// expanded, the lint machinery and the check-cfg impl, we
+// miss the #[allow], althrough we probably shoudln't.
+//
+// cf. https://github.com/rust-lang/rust/issues/124735
//
//@ check-pass
//@ no-auto-check-cfg
-//@ compile-flags: --check-cfg=cfg()
+//@ compile-flags: --check-cfg=cfg() --cfg=unknown_but_active_cfg
#[allow(unexpected_cfgs)]
#[cfg(FALSE)]
//~^ WARNING unexpected `cfg` condition name
fn bar() {}
+#[allow(unexpected_cfgs)]
+#[cfg(unknown_but_active_cfg)]
+//~^ WARNING unexpected `cfg` condition name
+fn bar() {}
+
fn main() {}
diff --git a/tests/ui/check-cfg/allow-same-level.stderr b/tests/ui/check-cfg/allow-same-level.stderr
index 5d74b2116543..a705cd4e5f01 100644
--- a/tests/ui/check-cfg/allow-same-level.stderr
+++ b/tests/ui/check-cfg/allow-same-level.stderr
@@ -1,13 +1,21 @@
warning: unexpected `cfg` condition name: `FALSE`
- --> $DIR/allow-same-level.rs:8:7
+ --> $DIR/allow-same-level.rs:15:7
|
LL | #[cfg(FALSE)]
| ^^^^^
|
- = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
= help: to expect this configuration use `--check-cfg=cfg(FALSE)`
= note: see for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
-warning: 1 warning emitted
+warning: unexpected `cfg` condition name: `unknown_but_active_cfg`
+ --> $DIR/allow-same-level.rs:20:7
+ |
+LL | #[cfg(unknown_but_active_cfg)]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: to expect this configuration use `--check-cfg=cfg(unknown_but_active_cfg)`
+ = note: see for more information about checking conditional configuration
+
+warning: 2 warnings emitted
diff --git a/tests/ui/check-cfg/cargo-build-script.stderr b/tests/ui/check-cfg/cargo-build-script.stderr
index fb48751bc1db..df0bc47571c7 100644
--- a/tests/ui/check-cfg/cargo-build-script.stderr
+++ b/tests/ui/check-cfg/cargo-build-script.stderr
@@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `has_foo`
LL | #[cfg(has_foo)]
| ^^^^^^^
|
- = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `has_bar`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
+ = help: expected names are: `has_bar` and 30 more
= help: consider using a Cargo feature instead
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
[lints.rust]
diff --git a/tests/ui/check-cfg/cargo-feature.none.stderr b/tests/ui/check-cfg/cargo-feature.none.stderr
index aa2a1ab8fb2f..58813a1f6770 100644
--- a/tests/ui/check-cfg/cargo-feature.none.stderr
+++ b/tests/ui/check-cfg/cargo-feature.none.stderr
@@ -1,5 +1,5 @@
warning: unexpected `cfg` condition value: `serde`
- --> $DIR/cargo-feature.rs:14:7
+ --> $DIR/cargo-feature.rs:15:7
|
LL | #[cfg(feature = "serde")]
| ^^^^^^^^^^^^^^^^^ help: remove the condition
@@ -10,7 +10,7 @@ LL | #[cfg(feature = "serde")]
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: (none)
- --> $DIR/cargo-feature.rs:18:7
+ --> $DIR/cargo-feature.rs:19:7
|
LL | #[cfg(feature)]
| ^^^^^^^ help: remove the condition
@@ -20,12 +20,12 @@ LL | #[cfg(feature)]
= note: see for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `tokio_unstable`
- --> $DIR/cargo-feature.rs:22:7
+ --> $DIR/cargo-feature.rs:23:7
|
LL | #[cfg(tokio_unstable)]
| ^^^^^^^^^^^^^^
|
- = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
+ = help: expected names are: `docsrs`, `feature`, and `test` and 30 more
= help: consider using a Cargo feature instead
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
[lints.rust]
@@ -34,7 +34,7 @@ LL | #[cfg(tokio_unstable)]
= note: see for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `CONFIG_NVME`
- --> $DIR/cargo-feature.rs:26:7
+ --> $DIR/cargo-feature.rs:27:7
|
LL | #[cfg(CONFIG_NVME = "m")]
| ^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/check-cfg/cargo-feature.rs b/tests/ui/check-cfg/cargo-feature.rs
index 13faf7f28200..a9380ddae1a9 100644
--- a/tests/ui/check-cfg/cargo-feature.rs
+++ b/tests/ui/check-cfg/cargo-feature.rs
@@ -6,6 +6,7 @@
//@ no-auto-check-cfg
//@ revisions: some none
//@ rustc-env:CARGO_CRATE_NAME=foo
+//@ compile-flags: --check-cfg=cfg(docsrs,test)
//@ [none]compile-flags: --check-cfg=cfg(feature,values())
//@ [some]compile-flags: --check-cfg=cfg(feature,values("bitcode"))
//@ [some]compile-flags: --check-cfg=cfg(CONFIG_NVME,values("y"))
diff --git a/tests/ui/check-cfg/cargo-feature.some.stderr b/tests/ui/check-cfg/cargo-feature.some.stderr
index c3ba123985b1..5a12be813387 100644
--- a/tests/ui/check-cfg/cargo-feature.some.stderr
+++ b/tests/ui/check-cfg/cargo-feature.some.stderr
@@ -1,5 +1,5 @@
warning: unexpected `cfg` condition value: `serde`
- --> $DIR/cargo-feature.rs:14:7
+ --> $DIR/cargo-feature.rs:15:7
|
LL | #[cfg(feature = "serde")]
| ^^^^^^^^^^^^^^^^^
@@ -10,7 +10,7 @@ LL | #[cfg(feature = "serde")]
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: (none)
- --> $DIR/cargo-feature.rs:18:7
+ --> $DIR/cargo-feature.rs:19:7
|
LL | #[cfg(feature)]
| ^^^^^^^- help: specify a config value: `= "bitcode"`
@@ -20,12 +20,12 @@ LL | #[cfg(feature)]
= note: see for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `tokio_unstable`
- --> $DIR/cargo-feature.rs:22:7
+ --> $DIR/cargo-feature.rs:23:7
|
LL | #[cfg(tokio_unstable)]
| ^^^^^^^^^^^^^^
|
- = help: expected names are: `CONFIG_NVME`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
+ = help: expected names are: `CONFIG_NVME`, `docsrs`, `feature`, and `test` and 30 more
= help: consider using a Cargo feature instead
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
[lints.rust]
@@ -34,7 +34,7 @@ LL | #[cfg(tokio_unstable)]
= note: see for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `m`
- --> $DIR/cargo-feature.rs:26:7
+ --> $DIR/cargo-feature.rs:27:7
|
LL | #[cfg(CONFIG_NVME = "m")]
| ^^^^^^^^^^^^^^---
diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr
index b7dc27f9ba9d..7c276c581707 100644
--- a/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr
+++ b/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr
@@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `value`
LL | #[cfg(value)]
| ^^^^^
|
- = help: expected names are: `bar`, `bee`, `clippy`, `cow`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
+ = help: expected names are: `bar`, `bee`, `cow`, and `foo` and 30 more
= help: to expect this configuration use `--check-cfg=cfg(value)`
= note: see for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr
index d2af81d7787c..9687a043e832 100644
--- a/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr
+++ b/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr
@@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_value`
LL | #[cfg(my_value)]
| ^^^^^^^^
|
- = help: expected names are: `bar`, `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
+ = help: expected names are: `bar` and `foo` and 30 more
= help: to expect this configuration use `--check-cfg=cfg(my_value)`
= note: see for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr
index 85bf66eb10cb..883679ddf9c8 100644
--- a/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr
+++ b/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr
@@ -4,7 +4,6 @@ warning: unexpected `cfg` condition name: `linux`
LL | #[cfg(linux)]
| ^^^^^ help: found config with similar value: `target_os = "linux"`
|
- = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
= help: to expect this configuration use `--check-cfg=cfg(linux)`
= note: see for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
diff --git a/tests/ui/check-cfg/compact-names.stderr b/tests/ui/check-cfg/compact-names.stderr
index ef0a413bd0d7..74ed0337e3b1 100644
--- a/tests/ui/check-cfg/compact-names.stderr
+++ b/tests/ui/check-cfg/compact-names.stderr
@@ -4,7 +4,6 @@ warning: unexpected `cfg` condition name: `target_architecture`
LL | #[cfg(target(os = "linux", architecture = "arm"))]
| ^^^^^^^^^^^^^^^^^^^^
|
- = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
= help: to expect this configuration use `--check-cfg=cfg(target_architecture, values("arm"))`
= note: see for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
diff --git a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr
index 23b6edacce77..7e77ba63a127 100644
--- a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr
+++ b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr
@@ -4,7 +4,6 @@ warning: unexpected `cfg` condition name: `unknown_key`
LL | #[cfg(unknown_key = "value")]
| ^^^^^^^^^^^^^^^^^^^^^
|
- = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
= help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))`
= note: see for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
diff --git a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr
index 804d7fb9163d..10302f0a7e46 100644
--- a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr
+++ b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr
@@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key`
LL | #[cfg(unknown_key = "value")]
| ^^^^^^^^^^^^^^^^^^^^^
|
- = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
+ = help: expected names are: `feature` and 30 more
= help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))`
= note: see for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
diff --git a/tests/ui/check-cfg/exhaustive-names-values.full.stderr b/tests/ui/check-cfg/exhaustive-names-values.full.stderr
index 804d7fb9163d..10302f0a7e46 100644
--- a/tests/ui/check-cfg/exhaustive-names-values.full.stderr
+++ b/tests/ui/check-cfg/exhaustive-names-values.full.stderr
@@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key`
LL | #[cfg(unknown_key = "value")]
| ^^^^^^^^^^^^^^^^^^^^^
|
- = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
+ = help: expected names are: `feature` and 30 more
= help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))`
= note: see for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
diff --git a/tests/ui/check-cfg/exhaustive-names.stderr b/tests/ui/check-cfg/exhaustive-names.stderr
index d134cfcfd29b..4d56d24acafc 100644
--- a/tests/ui/check-cfg/exhaustive-names.stderr
+++ b/tests/ui/check-cfg/exhaustive-names.stderr
@@ -4,7 +4,6 @@ warning: unexpected `cfg` condition name: `unknown_key`
LL | #[cfg(unknown_key = "value")]
| ^^^^^^^^^^^^^^^^^^^^^
|
- = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
= help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))`
= note: see for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
diff --git a/tests/ui/check-cfg/mix.stderr b/tests/ui/check-cfg/mix.stderr
index 76c7befd6d33..033aaef848f7 100644
--- a/tests/ui/check-cfg/mix.stderr
+++ b/tests/ui/check-cfg/mix.stderr
@@ -44,7 +44,7 @@ warning: unexpected `cfg` condition name: `uu`
LL | #[cfg_attr(uu, unix)]
| ^^
|
- = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
+ = help: expected names are: `feature` and 30 more
= help: to expect this configuration use `--check-cfg=cfg(uu)`
= note: see for more information about checking conditional configuration
diff --git a/tests/ui/check-cfg/raw-keywords.edition2015.stderr b/tests/ui/check-cfg/raw-keywords.edition2015.stderr
index 3ad8ebac959b..f19ded9cb671 100644
--- a/tests/ui/check-cfg/raw-keywords.edition2015.stderr
+++ b/tests/ui/check-cfg/raw-keywords.edition2015.stderr
@@ -14,7 +14,7 @@ warning: unexpected `cfg` condition name: `r#false`
LL | #[cfg(r#false)]
| ^^^^^^^
|
- = help: expected names are: `async`, `clippy`, `debug_assertions`, `doc`, `doctest`, `edition2015`, `edition2021`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `r#true`, `ub_checks`, `unix`, and `windows`
+ = help: expected names are: `async`, `edition2015`, `edition2021`, and `r#true` and 30 more
= help: to expect this configuration use `--check-cfg=cfg(r#false)`
= note: see for more information about checking conditional configuration
diff --git a/tests/ui/check-cfg/raw-keywords.edition2021.stderr b/tests/ui/check-cfg/raw-keywords.edition2021.stderr
index ff43a3326979..6096148a259b 100644
--- a/tests/ui/check-cfg/raw-keywords.edition2021.stderr
+++ b/tests/ui/check-cfg/raw-keywords.edition2021.stderr
@@ -14,7 +14,7 @@ warning: unexpected `cfg` condition name: `r#false`
LL | #[cfg(r#false)]
| ^^^^^^^
|
- = help: expected names are: `r#async`, `clippy`, `debug_assertions`, `doc`, `doctest`, `edition2015`, `edition2021`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `r#true`, `ub_checks`, `unix`, and `windows`
+ = help: expected names are: `r#async`, `edition2015`, `edition2021`, and `r#true` and 30 more
= help: to expect this configuration use `--check-cfg=cfg(r#false)`
= note: see for more information about checking conditional configuration
diff --git a/tests/ui/check-cfg/report-in-external-macros.cargo.stderr b/tests/ui/check-cfg/report-in-external-macros.cargo.stderr
index b82a09917f4e..a6584d777a3a 100644
--- a/tests/ui/check-cfg/report-in-external-macros.cargo.stderr
+++ b/tests/ui/check-cfg/report-in-external-macros.cargo.stderr
@@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_lib_cfg`
LL | cfg_macro::my_lib_macro!();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
+ = help: expected names are: `feature` and 30 more
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
= help: try referring to `cfg_macro::my_lib_macro` crate for guidance on how handle this unexpected cfg
= help: the macro `cfg_macro::my_lib_macro` may come from an old version of the `cfg_macro` crate, try updating your dependency with `cargo update -p cfg_macro`
diff --git a/tests/ui/check-cfg/report-in-external-macros.rustc.stderr b/tests/ui/check-cfg/report-in-external-macros.rustc.stderr
index 85d84a1e1ee3..914b5a0efe36 100644
--- a/tests/ui/check-cfg/report-in-external-macros.rustc.stderr
+++ b/tests/ui/check-cfg/report-in-external-macros.rustc.stderr
@@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_lib_cfg`
LL | cfg_macro::my_lib_macro!();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
+ = help: expected names are: `feature` and 30 more
= note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate
= help: try referring to `cfg_macro::my_lib_macro` crate for guidance on how handle this unexpected cfg
= help: to expect this configuration use `--check-cfg=cfg(my_lib_cfg)`
diff --git a/tests/ui/check-cfg/stmt-no-ice.stderr b/tests/ui/check-cfg/stmt-no-ice.stderr
index d8c6b0f3cec8..3cf43c6aece1 100644
--- a/tests/ui/check-cfg/stmt-no-ice.stderr
+++ b/tests/ui/check-cfg/stmt-no-ice.stderr
@@ -4,7 +4,6 @@ warning: unexpected `cfg` condition name: `crossbeam_loom`
LL | #[cfg(crossbeam_loom)]
| ^^^^^^^^^^^^^^
|
- = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
= help: to expect this configuration use `--check-cfg=cfg(crossbeam_loom)`
= note: see for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
diff --git a/tests/ui/check-cfg/unexpected-cfg-name.stderr b/tests/ui/check-cfg/unexpected-cfg-name.stderr
index 4ca7209cc07b..7708d9e3cd43 100644
--- a/tests/ui/check-cfg/unexpected-cfg-name.stderr
+++ b/tests/ui/check-cfg/unexpected-cfg-name.stderr
@@ -14,7 +14,6 @@ warning: unexpected `cfg` condition name: `test`
LL | #[cfg(test)]
| ^^^^
|
- = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
= help: to expect this configuration use `--check-cfg=cfg(test)`
= note: see for more information about checking conditional configuration
diff --git a/tests/ui/check-cfg/well-known-names.rs b/tests/ui/check-cfg/well-known-names.rs
index b84710ca8399..39fa3a37d1ad 100644
--- a/tests/ui/check-cfg/well-known-names.rs
+++ b/tests/ui/check-cfg/well-known-names.rs
@@ -2,7 +2,12 @@
//
//@ check-pass
//@ no-auto-check-cfg
-//@ compile-flags: --check-cfg=cfg()
+//@ compile-flags: --check-cfg=cfg() -Zcheck-cfg-all-expected
+//@ normalize-stderr: "`, `" -> "`\n`"
+
+#[cfg(list_all_well_known_cfgs)]
+//~^ WARNING unexpected `cfg` condition name
+fn in_diagnostics() {}
#[cfg(target_oz = "linux")]
//~^ WARNING unexpected `cfg` condition name
diff --git a/tests/ui/check-cfg/well-known-names.stderr b/tests/ui/check-cfg/well-known-names.stderr
index 61d518627bae..4ff90261158b 100644
--- a/tests/ui/check-cfg/well-known-names.stderr
+++ b/tests/ui/check-cfg/well-known-names.stderr
@@ -1,29 +1,66 @@
+warning: unexpected `cfg` condition name: `list_all_well_known_cfgs`
+ --> $DIR/well-known-names.rs:8:7
+ |
+LL | #[cfg(list_all_well_known_cfgs)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expected names are: `clippy`
+`debug_assertions`
+`doc`
+`doctest`
+`fmt_debug`
+`miri`
+`overflow_checks`
+`panic`
+`proc_macro`
+`relocation_model`
+`rustfmt`
+`sanitize`
+`sanitizer_cfi_generalize_pointers`
+`sanitizer_cfi_normalize_integers`
+`target_abi`
+`target_arch`
+`target_endian`
+`target_env`
+`target_family`
+`target_feature`
+`target_has_atomic`
+`target_has_atomic_equal_alignment`
+`target_has_atomic_load_store`
+`target_os`
+`target_pointer_width`
+`target_thread_local`
+`target_vendor`
+`ub_checks`
+`unix`, and `windows`
+ = help: to expect this configuration use `--check-cfg=cfg(list_all_well_known_cfgs)`
+ = note: see for more information about checking conditional configuration
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
warning: unexpected `cfg` condition name: `target_oz`
- --> $DIR/well-known-names.rs:7:7
+ --> $DIR/well-known-names.rs:12:7
|
LL | #[cfg(target_oz = "linux")]
| ^^^^^^^^^^^^^^^^^^^
|
= help: to expect this configuration use `--check-cfg=cfg(target_oz, values("linux"))`
= note: see for more information about checking conditional configuration
- = note: `#[warn(unexpected_cfgs)]` on by default
help: there is a config with a similar name and value
|
LL | #[cfg(target_os = "linux")]
| ~~~~~~~~~
warning: unexpected `cfg` condition name: `features`
- --> $DIR/well-known-names.rs:14:7
+ --> $DIR/well-known-names.rs:19:7
|
LL | #[cfg(features = "foo")]
| ^^^^^^^^^^^^^^^^
|
- = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
= help: to expect this configuration use `--check-cfg=cfg(features, values("foo"))`
= note: see for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `feature`
- --> $DIR/well-known-names.rs:18:7
+ --> $DIR/well-known-names.rs:23:7
|
LL | #[cfg(feature = "foo")]
| ^^^^^^^^^^^^^^^
@@ -32,7 +69,7 @@ LL | #[cfg(feature = "foo")]
= note: see for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `uniw`
- --> $DIR/well-known-names.rs:22:7
+ --> $DIR/well-known-names.rs:27:7
|
LL | #[cfg(uniw)]
| ^^^^ help: there is a config with a similar name: `unix`
@@ -40,5 +77,5 @@ LL | #[cfg(uniw)]
= help: to expect this configuration use `--check-cfg=cfg(uniw)`
= note: see for more information about checking conditional configuration
-warning: 4 warnings emitted
+warning: 5 warnings emitted
diff --git a/tests/ui/closures/2229_closure_analysis/issue-87987.rs b/tests/ui/closures/2229_closure_analysis/issue-87987.rs
deleted file mode 100644
index f79a8f1b5710..000000000000
--- a/tests/ui/closures/2229_closure_analysis/issue-87987.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-//@ run-pass
-//@ edition:2021
-
-struct Props {
- field_1: u32, //~ WARNING: fields `field_1` and `field_2` are never read
- field_2: u32,
-}
-
-fn main() {
- // Test 1
- let props_2 = Props { field_1: 1, field_2: 1 };
-
- let _ = || {
- let _: Props = props_2;
- };
-
- // Test 2
- let mut arr = [1, 3, 4, 5];
-
- let mref = &mut arr;
-
- let _c = || match arr {
- [_, _, _, _] => println!("A"),
- };
-
- println!("{:#?}", mref);
-}
diff --git a/tests/ui/closures/2229_closure_analysis/issue-87987.stderr b/tests/ui/closures/2229_closure_analysis/issue-87987.stderr
deleted file mode 100644
index 5696a010c3f8..000000000000
--- a/tests/ui/closures/2229_closure_analysis/issue-87987.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-warning: fields `field_1` and `field_2` are never read
- --> $DIR/issue-87987.rs:5:5
- |
-LL | struct Props {
- | ----- fields in this struct
-LL | field_1: u32,
- | ^^^^^^^
-LL | field_2: u32,
- | ^^^^^^^
- |
- = note: `#[warn(dead_code)]` on by default
-
-warning: 1 warning emitted
-
diff --git a/tests/ui/closures/2229_closure_analysis/unresolvable-upvar-issue-87987.rs b/tests/ui/closures/2229_closure_analysis/unresolvable-upvar-issue-87987.rs
new file mode 100644
index 000000000000..c501e034c97d
--- /dev/null
+++ b/tests/ui/closures/2229_closure_analysis/unresolvable-upvar-issue-87987.rs
@@ -0,0 +1,46 @@
+//! When a closure syntactically captures a place, but doesn't actually capture
+//! it, make sure MIR building doesn't ICE when handling that place.
+//!
+//! Under the Rust 2021 disjoint capture rules, this sort of non-capture can
+//! occur when a place is only inspected by infallible non-binding patterns.
+
+// FIXME(#135985): On its own, this test should probably just be check-pass.
+// But there are few/no other tests that use non-binding array patterns and
+// invoke the later parts of the compiler, so building/running has some value.
+
+//@ run-pass
+//@ edition:2021
+
+#[expect(dead_code)]
+struct Props {
+ field_1: u32,
+ field_2: u32,
+}
+
+fn main() {
+ // Test 1
+ let props_2 = Props { field_1: 1, field_2: 1 };
+
+ let _ = || {
+ let _: Props = props_2;
+ };
+
+ // Test 2
+ let mut arr = [1, 3, 4, 5];
+
+ let mref = &mut arr;
+
+ // These array patterns don't need to inspect the array, so the array
+ // isn't captured.
+ let _c = || match arr {
+ [_, _, _, _] => println!("C"),
+ };
+ let _d = || match arr {
+ [_, .., _] => println!("D"),
+ };
+ let _e = || match arr {
+ [_, ..] => println!("E"),
+ };
+
+ println!("{:#?}", mref);
+}
diff --git a/tests/ui/coherence/conflicting-impl-with-err.stderr b/tests/ui/coherence/conflicting-impl-with-err.stderr
index 3009b452dc7a..75a201797b55 100644
--- a/tests/ui/coherence/conflicting-impl-with-err.stderr
+++ b/tests/ui/coherence/conflicting-impl-with-err.stderr
@@ -1,14 +1,18 @@
-error[E0433]: failed to resolve: use of undeclared crate or module `nope`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nope`
--> $DIR/conflicting-impl-with-err.rs:4:11
|
LL | impl From for Error {
- | ^^^^ use of undeclared crate or module `nope`
+ | ^^^^ use of unresolved module or unlinked crate `nope`
+ |
+ = help: you might be missing a crate named `nope`
-error[E0433]: failed to resolve: use of undeclared crate or module `nope`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nope`
--> $DIR/conflicting-impl-with-err.rs:5:16
|
LL | fn from(_: nope::Thing) -> Self {
- | ^^^^ use of undeclared crate or module `nope`
+ | ^^^^ use of unresolved module or unlinked crate `nope`
+ |
+ = help: you might be missing a crate named `nope`
error: aborting due to 2 previous errors
diff --git a/tests/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr b/tests/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr
index 1de1c78faf6e..a506f2a282bb 100644
--- a/tests/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr
+++ b/tests/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr
@@ -4,7 +4,7 @@ error: const function that might be (indirectly) exposed to stable cannot use `#
LL | const fn bar() -> u32 { foo() }
| ^^^^^
|
- = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features
+ = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features
help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
|
LL + #[rustc_const_unstable(feature = "...", issue = "...")]
diff --git a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr
index 899cec07ac70..26dedc49a392 100644
--- a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr
+++ b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr
@@ -4,7 +4,7 @@ error: const function that might be (indirectly) exposed to stable cannot use `#
LL | const fn bar() -> u32 { foo() }
| ^^^^^
|
- = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features
+ = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features
help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
|
LL + #[rustc_const_unstable(feature = "...", issue = "...")]
@@ -22,7 +22,7 @@ error: const function that might be (indirectly) exposed to stable cannot use `#
LL | const fn bar2() -> u32 { foo2() }
| ^^^^^^
|
- = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features
+ = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features
help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
|
LL + #[rustc_const_unstable(feature = "...", issue = "...")]
@@ -57,7 +57,7 @@ error: const function that might be (indirectly) exposed to stable cannot use `#
LL | foo()
| ^^^^^
|
- = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features
+ = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features
help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
|
LL + #[rustc_const_unstable(feature = "...", issue = "...")]
@@ -75,7 +75,7 @@ error: const function that might be (indirectly) exposed to stable cannot use `#
LL | const fn bar2_gated() -> u32 { foo2_gated() }
| ^^^^^^^^^^^^
|
- = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features
+ = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features
help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
|
LL + #[rustc_const_unstable(feature = "...", issue = "...")]
@@ -93,7 +93,7 @@ error: const function that might be (indirectly) exposed to stable cannot use `#
LL | pub(crate) const fn bar2_gated_stable_indirect() -> u32 { super::foo2_gated() }
| ^^^^^^^^^^^^^^^^^^^
|
- = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features
+ = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features
help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
|
LL + #[rustc_const_unstable(feature = "...", issue = "...")]
@@ -111,7 +111,7 @@ error: const function that might be (indirectly) exposed to stable cannot use `#
LL | const fn stable_indirect() -> u32 { foo2_gated() }
| ^^^^^^^^^^^^
|
- = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features
+ = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features
help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
|
LL + #[rustc_const_unstable(feature = "...", issue = "...")]
diff --git a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr
index 442a079020f1..b61f7db6f43b 100644
--- a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr
+++ b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr
@@ -4,7 +4,7 @@ error: const function that might be (indirectly) exposed to stable cannot use `#
LL | const unsafe fn bar() -> u32 { unsafe { foo() } }
| ^^^^^
|
- = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features
+ = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features
help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
|
LL + #[rustc_const_unstable(feature = "...", issue = "...")]
@@ -22,7 +22,7 @@ error: const function that might be (indirectly) exposed to stable cannot use `#
LL | const unsafe fn bar2() -> u32 { unsafe { foo2() } }
| ^^^^^^
|
- = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features
+ = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features
help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
|
LL + #[rustc_const_unstable(feature = "...", issue = "...")]
@@ -40,7 +40,7 @@ error: const function that might be (indirectly) exposed to stable cannot use `#
LL | const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } }
| ^^^^^^^^^^^^
|
- = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features
+ = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features
help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
|
LL + #[rustc_const_unstable(feature = "...", issue = "...")]
diff --git a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr
index ff37cba7b9ac..fad8e396e9ab 100644
--- a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr
+++ b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr
@@ -4,7 +4,7 @@ error: const function that might be (indirectly) exposed to stable cannot use `#
LL | const unsafe fn bar() -> u32 { foo() }
| ^^^^^
|
- = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features
+ = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features
help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
|
LL + #[rustc_const_unstable(feature = "...", issue = "...")]
@@ -22,7 +22,7 @@ error: const function that might be (indirectly) exposed to stable cannot use `#
LL | const unsafe fn bar2() -> u32 { foo2() }
| ^^^^^^
|
- = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features
+ = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features
help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
|
LL + #[rustc_const_unstable(feature = "...", issue = "...")]
@@ -40,7 +40,7 @@ error: const function that might be (indirectly) exposed to stable cannot use `#
LL | const unsafe fn bar2_gated() -> u32 { foo2_gated() }
| ^^^^^^^^^^^^
|
- = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features
+ = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features
help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
|
LL + #[rustc_const_unstable(feature = "...", issue = "...")]
diff --git a/tests/ui/consts/min_const_fn/recursive_const_stab_unmarked_crate_imports.stderr b/tests/ui/consts/min_const_fn/recursive_const_stab_unmarked_crate_imports.stderr
index a655c0faab62..bbe749f59589 100644
--- a/tests/ui/consts/min_const_fn/recursive_const_stab_unmarked_crate_imports.stderr
+++ b/tests/ui/consts/min_const_fn/recursive_const_stab_unmarked_crate_imports.stderr
@@ -4,7 +4,7 @@ error: const function that might be (indirectly) exposed to stable cannot use `#
LL | unstable_if_unmarked_const_fn_crate::not_stably_const();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features
+ = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features
help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
|
LL + #[rustc_const_unstable(feature = "...", issue = "...")]
diff --git a/tests/ui/consts/min_const_fn/recursive_const_stab_unstable_if_unmarked.stderr b/tests/ui/consts/min_const_fn/recursive_const_stab_unstable_if_unmarked.stderr
index d4ba0f9df2da..9d7b81c822bd 100644
--- a/tests/ui/consts/min_const_fn/recursive_const_stab_unstable_if_unmarked.stderr
+++ b/tests/ui/consts/min_const_fn/recursive_const_stab_unstable_if_unmarked.stderr
@@ -4,7 +4,7 @@ error: const function that might be (indirectly) exposed to stable cannot use `#
LL | not_stably_const();
| ^^^^^^^^^^^^^^^^^^
|
- = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features
+ = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features
help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do)
|
LL + #[rustc_const_unstable(feature = "...", issue = "...")]
diff --git a/tests/ui/delegation/bad-resolve.rs b/tests/ui/delegation/bad-resolve.rs
index f15e6aa81afb..861f2b15da20 100644
--- a/tests/ui/delegation/bad-resolve.rs
+++ b/tests/ui/delegation/bad-resolve.rs
@@ -40,7 +40,7 @@ impl Trait for S {
}
mod prefix {}
-reuse unresolved_prefix::{a, b, c}; //~ ERROR use of undeclared crate or module `unresolved_prefix`
+reuse unresolved_prefix::{a, b, c}; //~ ERROR use of unresolved module or unlinked crate
reuse prefix::{self, super, crate}; //~ ERROR `crate` in paths can only be used in start position
fn main() {}
diff --git a/tests/ui/delegation/bad-resolve.stderr b/tests/ui/delegation/bad-resolve.stderr
index 32d2f3b26cb0..966387e1d616 100644
--- a/tests/ui/delegation/bad-resolve.stderr
+++ b/tests/ui/delegation/bad-resolve.stderr
@@ -81,11 +81,13 @@ LL | type Type;
LL | impl Trait for S {
| ^^^^^^^^^^^^^^^^ missing `Type` in implementation
-error[E0433]: failed to resolve: use of undeclared crate or module `unresolved_prefix`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `unresolved_prefix`
--> $DIR/bad-resolve.rs:43:7
|
LL | reuse unresolved_prefix::{a, b, c};
- | ^^^^^^^^^^^^^^^^^ use of undeclared crate or module `unresolved_prefix`
+ | ^^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `unresolved_prefix`
+ |
+ = help: you might be missing a crate named `unresolved_prefix`
error[E0433]: failed to resolve: `crate` in paths can only be used in start position
--> $DIR/bad-resolve.rs:44:29
diff --git a/tests/ui/delegation/glob-bad-path.rs b/tests/ui/delegation/glob-bad-path.rs
index 7bc4f0153a30..4ac9d68e8dd1 100644
--- a/tests/ui/delegation/glob-bad-path.rs
+++ b/tests/ui/delegation/glob-bad-path.rs
@@ -5,7 +5,7 @@ trait Trait {}
struct S;
impl Trait for u8 {
- reuse unresolved::*; //~ ERROR failed to resolve: use of undeclared crate or module `unresolved`
+ reuse unresolved::*; //~ ERROR failed to resolve: use of unresolved module or unlinked crate `unresolved`
reuse S::*; //~ ERROR expected trait, found struct `S`
}
diff --git a/tests/ui/delegation/glob-bad-path.stderr b/tests/ui/delegation/glob-bad-path.stderr
index 0c06364b3f0a..15d9ca412033 100644
--- a/tests/ui/delegation/glob-bad-path.stderr
+++ b/tests/ui/delegation/glob-bad-path.stderr
@@ -4,11 +4,11 @@ error: expected trait, found struct `S`
LL | reuse S::*;
| ^ not a trait
-error[E0433]: failed to resolve: use of undeclared crate or module `unresolved`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `unresolved`
--> $DIR/glob-bad-path.rs:8:11
|
LL | reuse unresolved::*;
- | ^^^^^^^^^^ use of undeclared crate or module `unresolved`
+ | ^^^^^^^^^^ use of unresolved module or unlinked crate `unresolved`
error: aborting due to 2 previous errors
diff --git a/tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.rs b/tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.rs
new file mode 100644
index 000000000000..76b93c0c947c
--- /dev/null
+++ b/tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.rs
@@ -0,0 +1,8 @@
+use std::rc::Rc;
+
+#[derive(PartialEq)] //~ NOTE in this expansion
+pub struct Function {
+ callback: Rc, //~ ERROR binary operation `==` cannot be applied to type `Rc`
+}
+
+fn main() {}
diff --git a/tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.stderr b/tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.stderr
new file mode 100644
index 000000000000..40464a49c343
--- /dev/null
+++ b/tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.stderr
@@ -0,0 +1,14 @@
+error[E0369]: binary operation `==` cannot be applied to type `Rc`
+ --> $DIR/do-not-suggest-calling-fn-in-derive-macro.rs:5:5
+ |
+LL | #[derive(PartialEq)]
+ | --------- in this derive macro expansion
+LL | pub struct Function {
+LL | callback: Rc,
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0369`.
diff --git a/tests/ui/diagnostic-width/non-copy-type-moved.rs b/tests/ui/diagnostic-width/non-copy-type-moved.rs
new file mode 100644
index 000000000000..a5593ad7b2a3
--- /dev/null
+++ b/tests/ui/diagnostic-width/non-copy-type-moved.rs
@@ -0,0 +1,17 @@
+//@ compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes
+//@ normalize-stderr: "long-type-\d+" -> "long-type-hash"
+type A = (String, String, String, String);
+type B = (A, A, A, A);
+type C = (B, B, B, B);
+type D = (C, C, C, C);
+
+trait Trait {}
+
+fn require_trait() {}
+
+fn foo(x: D) {
+ let _a = x;
+ let _b = x; //~ ERROR use of moved value
+}
+
+fn main() {}
diff --git a/tests/ui/diagnostic-width/non-copy-type-moved.stderr b/tests/ui/diagnostic-width/non-copy-type-moved.stderr
new file mode 100644
index 000000000000..da9385a5b4dc
--- /dev/null
+++ b/tests/ui/diagnostic-width/non-copy-type-moved.stderr
@@ -0,0 +1,20 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/non-copy-type-moved.rs:14:14
+ |
+LL | fn foo(x: D) {
+ | - move occurs because `x` has type `((..., ..., ..., ...), ..., ..., ...)`, which does not implement the `Copy` trait
+LL | let _a = x;
+ | - value moved here
+LL | let _b = x;
+ | ^ value used here after move
+ |
+ = note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/non-copy-type-moved/non-copy-type-moved.long-type-hash.txt'
+ = note: consider using `--verbose` to print the full type name to the console
+help: consider cloning the value if the performance cost is acceptable
+ |
+LL | let _a = x.clone();
+ | ++++++++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/tests/ui/dyn-compatibility/default-param-self-projection.rs b/tests/ui/dyn-compatibility/default-param-self-projection.rs
new file mode 100644
index 000000000000..a440cd735dab
--- /dev/null
+++ b/tests/ui/dyn-compatibility/default-param-self-projection.rs
@@ -0,0 +1,17 @@
+trait A::E> {}
+
+trait D {
+ type E;
+}
+
+impl A<()> for () {}
+impl D for () {
+ type E = ();
+}
+
+fn f() {
+ let B: &dyn A = &();
+ //~^ ERROR the type parameter `C` must be explicitly specified
+}
+
+fn main() {}
diff --git a/tests/ui/dyn-compatibility/default-param-self-projection.stderr b/tests/ui/dyn-compatibility/default-param-self-projection.stderr
new file mode 100644
index 000000000000..ea252a99b048
--- /dev/null
+++ b/tests/ui/dyn-compatibility/default-param-self-projection.stderr
@@ -0,0 +1,18 @@
+error[E0393]: the type parameter `C` must be explicitly specified
+ --> $DIR/default-param-self-projection.rs:13:17
+ |
+LL | trait A::E> {}
+ | --------------------------- type parameter `C` must be specified for this
+...
+LL | let B: &dyn A = &();
+ | ^
+ |
+ = note: because the parameter default references `Self`, the parameter must be specified on the object type
+help: set the type parameter to the desired type
+ |
+LL | let B: &dyn A = &();
+ | +++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0393`.
diff --git a/tests/ui/error-codes/E0393.stderr b/tests/ui/error-codes/E0393.stderr
index 489398b7be59..4847aa2508da 100644
--- a/tests/ui/error-codes/E0393.stderr
+++ b/tests/ui/error-codes/E0393.stderr
@@ -7,7 +7,7 @@ LL |
LL | fn together_we_will_rule_the_galaxy(son: &dyn A) {}
| ^
|
- = note: because of the default `Self` reference, type parameters must be specified on object types
+ = note: because the parameter default references `Self`, the parameter must be specified on the object type
help: set the type parameter to the desired type
|
LL | fn together_we_will_rule_the_galaxy(son: &dyn A) {}
diff --git a/tests/ui/error-codes/E0432.stderr b/tests/ui/error-codes/E0432.stderr
index 36fefc95897d..4ff8b40d1969 100644
--- a/tests/ui/error-codes/E0432.stderr
+++ b/tests/ui/error-codes/E0432.stderr
@@ -2,9 +2,9 @@ error[E0432]: unresolved import `something`
--> $DIR/E0432.rs:1:5
|
LL | use something::Foo;
- | ^^^^^^^^^ you might be missing crate `something`
+ | ^^^^^^^^^ use of unresolved module or unlinked crate `something`
|
-help: consider importing the `something` crate
+help: you might be missing a crate named `something`, add it to your project and import it in your code
|
LL + extern crate something;
|
diff --git a/tests/ui/extern-flag/multiple-opts.stderr b/tests/ui/extern-flag/multiple-opts.stderr
index 0aaca5ee253e..d0f38bad94c6 100644
--- a/tests/ui/extern-flag/multiple-opts.stderr
+++ b/tests/ui/extern-flag/multiple-opts.stderr
@@ -1,8 +1,10 @@
-error[E0433]: failed to resolve: use of undeclared crate or module `somedep`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `somedep`
--> $DIR/multiple-opts.rs:19:5
|
LL | somedep::somefun();
- | ^^^^^^^ use of undeclared crate or module `somedep`
+ | ^^^^^^^ use of unresolved module or unlinked crate `somedep`
+ |
+ = help: you might be missing a crate named `somedep`
error: aborting due to 1 previous error
diff --git a/tests/ui/extern-flag/noprelude.stderr b/tests/ui/extern-flag/noprelude.stderr
index 23b9b2fd94b2..fbd84956f66d 100644
--- a/tests/ui/extern-flag/noprelude.stderr
+++ b/tests/ui/extern-flag/noprelude.stderr
@@ -1,8 +1,10 @@
-error[E0433]: failed to resolve: use of undeclared crate or module `somedep`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `somedep`
--> $DIR/noprelude.rs:6:5
|
LL | somedep::somefun();
- | ^^^^^^^ use of undeclared crate or module `somedep`
+ | ^^^^^^^ use of unresolved module or unlinked crate `somedep`
+ |
+ = help: you might be missing a crate named `somedep`
error: aborting due to 1 previous error
diff --git a/tests/ui/feature-gates/feature-gate-optimize_attribute.rs b/tests/ui/feature-gates/feature-gate-optimize_attribute.rs
index 7f9cada6a47d..77cc307c9f45 100644
--- a/tests/ui/feature-gates/feature-gate-optimize_attribute.rs
+++ b/tests/ui/feature-gates/feature-gate-optimize_attribute.rs
@@ -6,6 +6,9 @@ fn size() {}
#[optimize(speed)] //~ ERROR the `#[optimize]` attribute is an experimental feature
fn speed() {}
+#[optimize(none)] //~ ERROR the `#[optimize]` attribute is an experimental feature
+fn none() {}
+
#[optimize(banana)]
//~^ ERROR the `#[optimize]` attribute is an experimental feature
//~| ERROR E0722
diff --git a/tests/ui/feature-gates/feature-gate-optimize_attribute.stderr b/tests/ui/feature-gates/feature-gate-optimize_attribute.stderr
index ca8f4a078f09..4e6e4ac2703a 100644
--- a/tests/ui/feature-gates/feature-gate-optimize_attribute.stderr
+++ b/tests/ui/feature-gates/feature-gate-optimize_attribute.stderr
@@ -21,6 +21,16 @@ LL | #[optimize(speed)]
error[E0658]: the `#[optimize]` attribute is an experimental feature
--> $DIR/feature-gate-optimize_attribute.rs:9:1
|
+LL | #[optimize(none)]
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #54882 for more information
+ = help: add `#![feature(optimize_attribute)]` to the crate attributes to enable
+ = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: the `#[optimize]` attribute is an experimental feature
+ --> $DIR/feature-gate-optimize_attribute.rs:12:1
+ |
LL | #[optimize(banana)]
| ^^^^^^^^^^^^^^^^^^^
|
@@ -29,12 +39,12 @@ LL | #[optimize(banana)]
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0722]: invalid argument
- --> $DIR/feature-gate-optimize_attribute.rs:9:12
+ --> $DIR/feature-gate-optimize_attribute.rs:12:12
|
LL | #[optimize(banana)]
| ^^^^^^
-error: aborting due to 4 previous errors
+error: aborting due to 5 previous errors
Some errors have detailed explanations: E0658, E0722.
For more information about an error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs
index 141927b4de8c..a196b8ecdb3e 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs
+++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs
@@ -81,20 +81,11 @@
#![crate_name = "0900"]
#![crate_type = "bin"] // cannot pass "0800" here
-#![crate_id = "10"]
-//~^ WARN use of deprecated attribute
-//~| HELP remove this attribute
-//~| NOTE `#[warn(deprecated)]` on by default
-
// FIXME(#44232) we should warn that this isn't used.
#![feature(rust1)]
//~^ WARN no longer requires an attribute to enable
//~| NOTE `#[warn(stable_features)]` on by default
-#![no_start]
-//~^ WARN use of deprecated attribute
-//~| HELP remove this attribute
-
// (cannot easily gating state of crate-level #[no_main]; but non crate-level is below at "0400")
#![no_builtins]
#![recursion_limit = "0200"]
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr
index 18fb75aafbb3..1c6868dc95d9 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr
+++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr
@@ -1,5 +1,5 @@
warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:400:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:391:17
|
LL | mod inner { #![macro_escape] }
| ^^^^^^^^^^^^^^^^
@@ -7,7 +7,7 @@ LL | mod inner { #![macro_escape] }
= help: try an outer attribute: `#[macro_use]`
warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:397:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:388:1
|
LL | #[macro_escape]
| ^^^^^^^^^^^^^^^
@@ -42,166 +42,152 @@ warning: unknown lint: `x5100`
LL | #![deny(x5100)]
| ^^^^^
-warning: use of deprecated attribute `crate_id`: no longer used
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:84:1
- |
-LL | #![crate_id = "10"]
- | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute
- |
- = note: `#[warn(deprecated)]` on by default
-
-warning: use of deprecated attribute `no_start`: no longer used
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:94:1
- |
-LL | #![no_start]
- | ^^^^^^^^^^^^ help: remove this attribute
-
warning: unknown lint: `x5400`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:105:8
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:96:8
|
LL | #[warn(x5400)]
| ^^^^^
warning: unknown lint: `x5400`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:108:25
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:99:25
|
LL | mod inner { #![warn(x5400)] }
| ^^^^^
warning: unknown lint: `x5400`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:111:12
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:102:12
|
LL | #[warn(x5400)] fn f() { }
| ^^^^^
warning: unknown lint: `x5400`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:114:12
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:105:12
|
LL | #[warn(x5400)] struct S;
| ^^^^^
warning: unknown lint: `x5400`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:117:12
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:108:12
|
LL | #[warn(x5400)] type T = S;
| ^^^^^
warning: unknown lint: `x5400`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:120:12
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:111:12
|
LL | #[warn(x5400)] impl S { }
| ^^^^^
warning: unknown lint: `x5300`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:124:9
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:115:9
|
LL | #[allow(x5300)]
| ^^^^^
warning: unknown lint: `x5300`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:127:26
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:118:26
|
LL | mod inner { #![allow(x5300)] }
| ^^^^^
warning: unknown lint: `x5300`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:130:13
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:121:13
|
LL | #[allow(x5300)] fn f() { }
| ^^^^^
warning: unknown lint: `x5300`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:133:13
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:124:13
|
LL | #[allow(x5300)] struct S;
| ^^^^^
warning: unknown lint: `x5300`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:136:13
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:127:13
|
LL | #[allow(x5300)] type T = S;
| ^^^^^
warning: unknown lint: `x5300`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:139:13
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:130:13
|
LL | #[allow(x5300)] impl S { }
| ^^^^^
warning: unknown lint: `x5200`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:143:10
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:134:10
|
LL | #[forbid(x5200)]
| ^^^^^
warning: unknown lint: `x5200`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:146:27
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:137:27
|
LL | mod inner { #![forbid(x5200)] }
| ^^^^^
warning: unknown lint: `x5200`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:149:14
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:140:14
|
LL | #[forbid(x5200)] fn f() { }
| ^^^^^
warning: unknown lint: `x5200`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:152:14
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:143:14
|
LL | #[forbid(x5200)] struct S;
| ^^^^^
warning: unknown lint: `x5200`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:155:14
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:146:14
|
LL | #[forbid(x5200)] type T = S;
| ^^^^^
warning: unknown lint: `x5200`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:158:14
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:149:14
|
LL | #[forbid(x5200)] impl S { }
| ^^^^^
warning: unknown lint: `x5100`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:162:8
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:153:8
|
LL | #[deny(x5100)]
| ^^^^^
warning: unknown lint: `x5100`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:165:25
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:156:25
|
LL | mod inner { #![deny(x5100)] }
| ^^^^^
warning: unknown lint: `x5100`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:168:12
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:159:12
|
LL | #[deny(x5100)] fn f() { }
| ^^^^^
warning: unknown lint: `x5100`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:171:12
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:162:12
|
LL | #[deny(x5100)] struct S;
| ^^^^^
warning: unknown lint: `x5100`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:174:12
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:165:12
|
LL | #[deny(x5100)] type T = S;
| ^^^^^
warning: unknown lint: `x5100`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:177:12
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:168:12
|
LL | #[deny(x5100)] impl S { }
| ^^^^^
warning: `#[macro_export]` only has an effect on macro definitions
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:198:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:189:1
|
LL | #[macro_export]
| ^^^^^^^^^^^^^^^
@@ -213,13 +199,13 @@ LL | #![warn(unused_attributes, unknown_lints)]
| ^^^^^^^^^^^^^^^^^
warning: `#[automatically_derived]` only has an effect on implementation blocks
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:266:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:257:1
|
LL | #[automatically_derived]
| ^^^^^^^^^^^^^^^^^^^^^^^^
warning: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:284:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:275:1
|
LL | #[no_mangle]
| ^^^^^^^^^^^^
@@ -234,31 +220,31 @@ LL | | }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: `#[should_panic]` only has an effect on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:324:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:315:1
|
LL | #[should_panic]
| ^^^^^^^^^^^^^^^
warning: `#[ignore]` only has an effect on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:342:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:333:1
|
LL | #[ignore]
| ^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:377:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:368:1
|
LL | #[reexport_test_harness_main = "2900"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:417:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:408:1
|
LL | #[no_std]
| ^^^^^^^^^
warning: attribute should be applied to a function definition
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:453:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:444:1
|
LL | #[cold]
| ^^^^^^^
@@ -274,7 +260,7 @@ LL | | }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a foreign function or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:482:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:473:1
|
LL | #[link_name = "1900"]
| ^^^^^^^^^^^^^^^^^^^^^
@@ -290,7 +276,7 @@ LL | | }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a function or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:521:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:512:1
|
LL | #[link_section = "1800"]
| ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -306,7 +292,7 @@ LL | | }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to an `extern` block with non-Rust ABI
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:553:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:544:1
|
LL | #[link()]
| ^^^^^^^^^
@@ -322,55 +308,55 @@ LL | | }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: `#[must_use]` has no effect when applied to a module
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:604:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:595:1
|
LL | #[must_use]
| ^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:617:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:608:1
|
LL | #[windows_subsystem = "windows"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:638:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:629:1
|
LL | #[crate_name = "0900"]
| ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:657:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:648:1
|
LL | #[crate_type = "0800"]
| ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:676:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:667:1
|
LL | #[feature(x0600)]
| ^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:696:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:687:1
|
LL | #[no_main]
| ^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:706:1
|
LL | #[no_builtins]
| ^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:734:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:725:1
|
LL | #[recursion_limit="0200"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:753:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:744:1
|
LL | #[type_length_limit="0100"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -432,109 +418,109 @@ LL | #![must_use]
| ^^^^^^^^^^^^
warning: `#[macro_use]` only has an effect on `extern crate` and modules
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:185:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:176:5
|
LL | #[macro_use] fn f() { }
| ^^^^^^^^^^^^
warning: `#[macro_use]` only has an effect on `extern crate` and modules
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:188:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:179:5
|
LL | #[macro_use] struct S;
| ^^^^^^^^^^^^
warning: `#[macro_use]` only has an effect on `extern crate` and modules
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:191:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:182:5
|
LL | #[macro_use] type T = S;
| ^^^^^^^^^^^^
warning: `#[macro_use]` only has an effect on `extern crate` and modules
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:194:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:185:5
|
LL | #[macro_use] impl S { }
| ^^^^^^^^^^^^
warning: `#[macro_export]` only has an effect on macro definitions
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:201:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:192:17
|
LL | mod inner { #![macro_export] }
| ^^^^^^^^^^^^^^^^
warning: `#[macro_export]` only has an effect on macro definitions
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:204:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:195:5
|
LL | #[macro_export] fn f() { }
| ^^^^^^^^^^^^^^^
warning: `#[macro_export]` only has an effect on macro definitions
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:207:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:198:5
|
LL | #[macro_export] struct S;
| ^^^^^^^^^^^^^^^
warning: `#[macro_export]` only has an effect on macro definitions
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:210:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:201:5
|
LL | #[macro_export] type T = S;
| ^^^^^^^^^^^^^^^
warning: `#[macro_export]` only has an effect on macro definitions
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:213:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:204:5
|
LL | #[macro_export] impl S { }
| ^^^^^^^^^^^^^^^
warning: `#[path]` only has an effect on modules
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:253:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:244:5
|
LL | #[path = "3800"] fn f() { }
| ^^^^^^^^^^^^^^^^
warning: `#[path]` only has an effect on modules
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:256:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:247:5
|
LL | #[path = "3800"] struct S;
| ^^^^^^^^^^^^^^^^
warning: `#[path]` only has an effect on modules
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:259:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:250:5
|
LL | #[path = "3800"] type T = S;
| ^^^^^^^^^^^^^^^^
warning: `#[path]` only has an effect on modules
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:262:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:253:5
|
LL | #[path = "3800"] impl S { }
| ^^^^^^^^^^^^^^^^
warning: `#[automatically_derived]` only has an effect on implementation blocks
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:269:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:260:17
|
LL | mod inner { #![automatically_derived] }
| ^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[automatically_derived]` only has an effect on implementation blocks
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:272:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:263:5
|
LL | #[automatically_derived] fn f() { }
| ^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[automatically_derived]` only has an effect on implementation blocks
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:275:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:266:5
|
LL | #[automatically_derived] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[automatically_derived]` only has an effect on implementation blocks
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:278:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:269:5
|
LL | #[automatically_derived] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^^^
warning: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:289:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:280:17
|
LL | mod inner { #![no_mangle] }
| ------------^^^^^^^^^^^^^-- not a free function, impl method or static
@@ -542,7 +528,7 @@ LL | mod inner { #![no_mangle] }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:296:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:287:5
|
LL | #[no_mangle] struct S;
| ^^^^^^^^^^^^ --------- not a free function, impl method or static
@@ -550,7 +536,7 @@ LL | #[no_mangle] struct S;
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:301:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:292:5
|
LL | #[no_mangle] type T = S;
| ^^^^^^^^^^^^ ----------- not a free function, impl method or static
@@ -558,7 +544,7 @@ LL | #[no_mangle] type T = S;
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:306:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:297:5
|
LL | #[no_mangle] impl S { }
| ^^^^^^^^^^^^ ---------- not a free function, impl method or static
@@ -566,7 +552,7 @@ LL | #[no_mangle] impl S { }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:312:9
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:303:9
|
LL | #[no_mangle] fn foo();
| ^^^^^^^^^^^^ --------- not a free function, impl method or static
@@ -574,7 +560,7 @@ LL | #[no_mangle] fn foo();
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:317:9
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:308:9
|
LL | #[no_mangle] fn bar() {}
| ^^^^^^^^^^^^ ----------- not a free function, impl method or static
@@ -582,163 +568,163 @@ LL | #[no_mangle] fn bar() {}
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: `#[should_panic]` only has an effect on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:327:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:318:17
|
LL | mod inner { #![should_panic] }
| ^^^^^^^^^^^^^^^^
warning: `#[should_panic]` only has an effect on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:332:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:323:5
|
LL | #[should_panic] struct S;
| ^^^^^^^^^^^^^^^
warning: `#[should_panic]` only has an effect on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:335:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:326:5
|
LL | #[should_panic] type T = S;
| ^^^^^^^^^^^^^^^
warning: `#[should_panic]` only has an effect on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:338:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:329:5
|
LL | #[should_panic] impl S { }
| ^^^^^^^^^^^^^^^
warning: `#[ignore]` only has an effect on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:345:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:336:17
|
LL | mod inner { #![ignore] }
| ^^^^^^^^^^
warning: `#[ignore]` only has an effect on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:350:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:341:5
|
LL | #[ignore] struct S;
| ^^^^^^^^^
warning: `#[ignore]` only has an effect on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:353:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:344:5
|
LL | #[ignore] type T = S;
| ^^^^^^^^^
warning: `#[ignore]` only has an effect on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:356:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:347:5
|
LL | #[ignore] impl S { }
| ^^^^^^^^^
warning: `#[no_implicit_prelude]` only has an effect on modules
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:364:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:355:5
|
LL | #[no_implicit_prelude] fn f() { }
| ^^^^^^^^^^^^^^^^^^^^^^
warning: `#[no_implicit_prelude]` only has an effect on modules
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:367:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:358:5
|
LL | #[no_implicit_prelude] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^
warning: `#[no_implicit_prelude]` only has an effect on modules
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:370:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:361:5
|
LL | #[no_implicit_prelude] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^
warning: `#[no_implicit_prelude]` only has an effect on modules
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:373:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:364:5
|
LL | #[no_implicit_prelude] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be in the root module
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:380:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:371:17
|
LL | mod inner { #![reexport_test_harness_main="2900"] }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:383:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:374:5
|
LL | #[reexport_test_harness_main = "2900"] fn f() { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:386:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:377:5
|
LL | #[reexport_test_harness_main = "2900"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:389:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:380:5
|
LL | #[reexport_test_harness_main = "2900"] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:392:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:383:5
|
LL | #[reexport_test_harness_main = "2900"] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: `#[macro_escape]` only has an effect on `extern crate` and modules
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:404:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:395:5
|
LL | #[macro_escape] fn f() { }
| ^^^^^^^^^^^^^^^
warning: `#[macro_escape]` only has an effect on `extern crate` and modules
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:407:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:398:5
|
LL | #[macro_escape] struct S;
| ^^^^^^^^^^^^^^^
warning: `#[macro_escape]` only has an effect on `extern crate` and modules
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:410:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:401:5
|
LL | #[macro_escape] type T = S;
| ^^^^^^^^^^^^^^^
warning: `#[macro_escape]` only has an effect on `extern crate` and modules
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:413:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:404:5
|
LL | #[macro_escape] impl S { }
| ^^^^^^^^^^^^^^^
warning: crate-level attribute should be in the root module
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:420:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:411:17
|
LL | mod inner { #![no_std] }
| ^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:423:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:414:5
|
LL | #[no_std] fn f() { }
| ^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:426:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:417:5
|
LL | #[no_std] struct S;
| ^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:429:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:420:5
|
LL | #[no_std] type T = S;
| ^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:432:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:423:5
|
LL | #[no_std] impl S { }
| ^^^^^^^^^
warning: attribute should be applied to a function definition
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:459:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:450:17
|
LL | mod inner { #![cold] }
| ------------^^^^^^^^-- not a function definition
@@ -746,7 +732,7 @@ LL | mod inner { #![cold] }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a function definition
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:466:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:457:5
|
LL | #[cold] struct S;
| ^^^^^^^ --------- not a function definition
@@ -754,7 +740,7 @@ LL | #[cold] struct S;
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a function definition
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:471:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:462:5
|
LL | #[cold] type T = S;
| ^^^^^^^ ----------- not a function definition
@@ -762,7 +748,7 @@ LL | #[cold] type T = S;
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a function definition
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:476:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:467:5
|
LL | #[cold] impl S { }
| ^^^^^^^ ---------- not a function definition
@@ -770,7 +756,7 @@ LL | #[cold] impl S { }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a foreign function or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:488:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:479:5
|
LL | #[link_name = "1900"]
| ^^^^^^^^^^^^^^^^^^^^^
@@ -780,13 +766,13 @@ LL | extern "C" { }
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
help: try `#[link(name = "1900")]` instead
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:488:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:479:5
|
LL | #[link_name = "1900"]
| ^^^^^^^^^^^^^^^^^^^^^
warning: attribute should be applied to a foreign function or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:495:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:486:17
|
LL | mod inner { #![link_name="1900"] }
| ------------^^^^^^^^^^^^^^^^^^^^-- not a foreign function or static
@@ -794,7 +780,7 @@ LL | mod inner { #![link_name="1900"] }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a foreign function or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:500:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:491:5
|
LL | #[link_name = "1900"] fn f() { }
| ^^^^^^^^^^^^^^^^^^^^^ ---------- not a foreign function or static
@@ -802,7 +788,7 @@ LL | #[link_name = "1900"] fn f() { }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a foreign function or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:505:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:496:5
|
LL | #[link_name = "1900"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^ --------- not a foreign function or static
@@ -810,7 +796,7 @@ LL | #[link_name = "1900"] struct S;
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a foreign function or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:510:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:501:5
|
LL | #[link_name = "1900"] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^ ----------- not a foreign function or static
@@ -818,7 +804,7 @@ LL | #[link_name = "1900"] type T = S;
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a foreign function or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:515:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:506:5
|
LL | #[link_name = "1900"] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^ ---------- not a foreign function or static
@@ -826,7 +812,7 @@ LL | #[link_name = "1900"] impl S { }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a function or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:527:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:518:17
|
LL | mod inner { #![link_section="1800"] }
| ------------^^^^^^^^^^^^^^^^^^^^^^^-- not a function or static
@@ -834,7 +820,7 @@ LL | mod inner { #![link_section="1800"] }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a function or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:534:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:525:5
|
LL | #[link_section = "1800"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^^^ --------- not a function or static
@@ -842,7 +828,7 @@ LL | #[link_section = "1800"] struct S;
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a function or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:539:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:530:5
|
LL | #[link_section = "1800"] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^^^ ----------- not a function or static
@@ -850,7 +836,7 @@ LL | #[link_section = "1800"] type T = S;
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to a function or static
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:544:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:535:5
|
LL | #[link_section = "1800"] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^^^ ---------- not a function or static
@@ -858,7 +844,7 @@ LL | #[link_section = "1800"] impl S { }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to an `extern` block with non-Rust ABI
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:559:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:550:17
|
LL | mod inner { #![link()] }
| ------------^^^^^^^^^^-- not an `extern` block
@@ -866,7 +852,7 @@ LL | mod inner { #![link()] }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to an `extern` block with non-Rust ABI
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:564:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:555:5
|
LL | #[link()] fn f() { }
| ^^^^^^^^^ ---------- not an `extern` block
@@ -874,7 +860,7 @@ LL | #[link()] fn f() { }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to an `extern` block with non-Rust ABI
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:569:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:560:5
|
LL | #[link()] struct S;
| ^^^^^^^^^ --------- not an `extern` block
@@ -882,7 +868,7 @@ LL | #[link()] struct S;
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to an `extern` block with non-Rust ABI
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:574:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:565:5
|
LL | #[link()] type T = S;
| ^^^^^^^^^ ----------- not an `extern` block
@@ -890,7 +876,7 @@ LL | #[link()] type T = S;
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to an `extern` block with non-Rust ABI
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:579:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:570:5
|
LL | #[link()] impl S { }
| ^^^^^^^^^ ---------- not an `extern` block
@@ -898,7 +884,7 @@ LL | #[link()] impl S { }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to an `extern` block with non-Rust ABI
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:584:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:575:5
|
LL | #[link()] extern "Rust" {}
| ^^^^^^^^^
@@ -906,270 +892,270 @@ LL | #[link()] extern "Rust" {}
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: `#[must_use]` has no effect when applied to a module
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:606:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:597:17
|
LL | mod inner { #![must_use] }
| ^^^^^^^^^^^^
warning: `#[must_use]` has no effect when applied to a type alias
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:612:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:603:5
|
LL | #[must_use] type T = S;
| ^^^^^^^^^^^
warning: `#[must_use]` has no effect when applied to an implementation block
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:614:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:605:5
|
LL | #[must_use] impl S { }
| ^^^^^^^^^^^
warning: crate-level attribute should be in the root module
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:620:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:611:17
|
LL | mod inner { #![windows_subsystem="windows"] }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:623:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:614:5
|
LL | #[windows_subsystem = "windows"] fn f() { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:626:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:617:5
|
LL | #[windows_subsystem = "windows"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:629:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:620:5
|
LL | #[windows_subsystem = "windows"] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:632:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:623:5
|
LL | #[windows_subsystem = "windows"] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be in the root module
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:641:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:632:17
|
LL | mod inner { #![crate_name="0900"] }
| ^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:644:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:635:5
|
LL | #[crate_name = "0900"] fn f() { }
| ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:647:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:638:5
|
LL | #[crate_name = "0900"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:650:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:641:5
|
LL | #[crate_name = "0900"] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:653:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:644:5
|
LL | #[crate_name = "0900"] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be in the root module
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:660:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:651:17
|
LL | mod inner { #![crate_type="0800"] }
| ^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:663:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:654:5
|
LL | #[crate_type = "0800"] fn f() { }
| ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:666:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:657:5
|
LL | #[crate_type = "0800"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:669:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:660:5
|
LL | #[crate_type = "0800"] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:672:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:663:5
|
LL | #[crate_type = "0800"] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be in the root module
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:679:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:670:17
|
LL | mod inner { #![feature(x0600)] }
| ^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:682:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:673:5
|
LL | #[feature(x0600)] fn f() { }
| ^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:685:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:676:5
|
LL | #[feature(x0600)] struct S;
| ^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:688:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:679:5
|
LL | #[feature(x0600)] type T = S;
| ^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:691:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:682:5
|
LL | #[feature(x0600)] impl S { }
| ^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be in the root module
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:699:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:690:17
|
LL | mod inner { #![no_main] }
| ^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:702:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:693:5
|
LL | #[no_main] fn f() { }
| ^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:705:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:696:5
|
LL | #[no_main] struct S;
| ^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:708:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:699:5
|
LL | #[no_main] type T = S;
| ^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:702:5
|
LL | #[no_main] impl S { }
| ^^^^^^^^^^
warning: crate-level attribute should be in the root module
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:718:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:709:17
|
LL | mod inner { #![no_builtins] }
| ^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:721:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:712:5
|
LL | #[no_builtins] fn f() { }
| ^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:724:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:5
|
LL | #[no_builtins] struct S;
| ^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:727:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:718:5
|
LL | #[no_builtins] type T = S;
| ^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:730:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:721:5
|
LL | #[no_builtins] impl S { }
| ^^^^^^^^^^^^^^
warning: crate-level attribute should be in the root module
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:737:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:728:17
|
LL | mod inner { #![recursion_limit="0200"] }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:740:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:731:5
|
LL | #[recursion_limit="0200"] fn f() { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:743:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:734:5
|
LL | #[recursion_limit="0200"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:746:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:737:5
|
LL | #[recursion_limit="0200"] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:749:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:740:5
|
LL | #[recursion_limit="0200"] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be in the root module
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:756:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:747:17
|
LL | mod inner { #![type_length_limit="0100"] }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:759:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:750:5
|
LL | #[type_length_limit="0100"] fn f() { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:762:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:753:5
|
LL | #[type_length_limit="0100"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:765:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:756:5
|
LL | #[type_length_limit="0100"] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:768:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:759:5
|
LL | #[type_length_limit="0100"] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: the feature `rust1` has been stable since 1.0.0 and no longer requires an attribute to enable
- --> $DIR/issue-43106-gating-of-builtin-attrs.rs:90:12
+ --> $DIR/issue-43106-gating-of-builtin-attrs.rs:85:12
|
LL | #![feature(rust1)]
| ^^^^^
|
= note: `#[warn(stable_features)]` on by default
-warning: 173 warnings emitted
+warning: 171 warnings emitted
diff --git a/tests/ui/foreign/stashed-issue-121451.rs b/tests/ui/foreign/stashed-issue-121451.rs
index 97a4af374758..77a736739bfa 100644
--- a/tests/ui/foreign/stashed-issue-121451.rs
+++ b/tests/ui/foreign/stashed-issue-121451.rs
@@ -1,4 +1,4 @@
extern "C" fn _f() -> libc::uintptr_t {}
-//~^ ERROR failed to resolve: use of undeclared crate or module `libc`
+//~^ ERROR failed to resolve
fn main() {}
diff --git a/tests/ui/foreign/stashed-issue-121451.stderr b/tests/ui/foreign/stashed-issue-121451.stderr
index 440d98d6f460..31dd3b4fb5e8 100644
--- a/tests/ui/foreign/stashed-issue-121451.stderr
+++ b/tests/ui/foreign/stashed-issue-121451.stderr
@@ -1,8 +1,10 @@
-error[E0433]: failed to resolve: use of undeclared crate or module `libc`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `libc`
--> $DIR/stashed-issue-121451.rs:1:23
|
LL | extern "C" fn _f() -> libc::uintptr_t {}
- | ^^^^ use of undeclared crate or module `libc`
+ | ^^^^ use of unresolved module or unlinked crate `libc`
+ |
+ = help: you might be missing a crate named `libc`
error: aborting due to 1 previous error
diff --git a/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.rs b/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.rs
index aaf831d1983e..71c33674b37f 100644
--- a/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.rs
+++ b/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.rs
@@ -10,7 +10,7 @@ macro a() {
mod u {
// Late resolution.
fn f() { my_core::mem::drop(0); }
- //~^ ERROR failed to resolve: use of undeclared crate or module `my_core`
+ //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `my_core`
}
}
@@ -23,7 +23,7 @@ mod v {
mod u {
// Late resolution.
fn f() { my_core::mem::drop(0); }
- //~^ ERROR failed to resolve: use of undeclared crate or module `my_core`
+ //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `my_core`
}
fn main() {}
diff --git a/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr b/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr
index cc229764ad3f..87ef07c27f5b 100644
--- a/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr
+++ b/tests/ui/hygiene/extern-prelude-from-opaque-fail-2018.stderr
@@ -15,25 +15,27 @@ LL | a!();
|
= note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `my_core`
--> $DIR/extern-prelude-from-opaque-fail-2018.rs:12:18
|
LL | fn f() { my_core::mem::drop(0); }
- | ^^^^^^^ use of undeclared crate or module `my_core`
+ | ^^^^^^^ use of unresolved module or unlinked crate `my_core`
...
LL | a!();
| ---- in this macro invocation
|
+ = help: you might be missing a crate named `my_core`
= help: consider importing this module:
std::mem
= note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `my_core`
--> $DIR/extern-prelude-from-opaque-fail-2018.rs:25:14
|
LL | fn f() { my_core::mem::drop(0); }
- | ^^^^^^^ use of undeclared crate or module `my_core`
+ | ^^^^^^^ use of unresolved module or unlinked crate `my_core`
|
+ = help: you might be missing a crate named `my_core`
help: consider importing this module
|
LL + use std::mem;
diff --git a/tests/ui/hygiene/extern-prelude-from-opaque-fail.rs b/tests/ui/hygiene/extern-prelude-from-opaque-fail.rs
index be3102aeab07..8265b73cc565 100644
--- a/tests/ui/hygiene/extern-prelude-from-opaque-fail.rs
+++ b/tests/ui/hygiene/extern-prelude-from-opaque-fail.rs
@@ -10,7 +10,7 @@ macro a() {
mod u {
// Late resolution.
fn f() { my_core::mem::drop(0); }
- //~^ ERROR failed to resolve: use of undeclared crate or module `my_core`
+ //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `my_core`
}
}
@@ -23,7 +23,7 @@ mod v {
mod u {
// Late resolution.
fn f() { my_core::mem::drop(0); }
- //~^ ERROR failed to resolve: use of undeclared crate or module `my_core`
+ //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `my_core`
}
fn main() {}
diff --git a/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr b/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr
index 13b2827ef39b..d36bc9130953 100644
--- a/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr
+++ b/tests/ui/hygiene/extern-prelude-from-opaque-fail.stderr
@@ -15,25 +15,27 @@ LL | a!();
|
= note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `my_core`
--> $DIR/extern-prelude-from-opaque-fail.rs:12:18
|
LL | fn f() { my_core::mem::drop(0); }
- | ^^^^^^^ use of undeclared crate or module `my_core`
+ | ^^^^^^^ use of unresolved module or unlinked crate `my_core`
...
LL | a!();
| ---- in this macro invocation
|
+ = help: you might be missing a crate named `my_core`
= help: consider importing this module:
my_core::mem
= note: this error originates in the macro `a` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0433]: failed to resolve: use of undeclared crate or module `my_core`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `my_core`
--> $DIR/extern-prelude-from-opaque-fail.rs:25:14
|
LL | fn f() { my_core::mem::drop(0); }
- | ^^^^^^^ use of undeclared crate or module `my_core`
+ | ^^^^^^^ use of unresolved module or unlinked crate `my_core`
|
+ = help: you might be missing a crate named `my_core`
help: consider importing this module
|
LL + use my_core::mem;
diff --git a/tests/ui/impl-trait/issue-72911.stderr b/tests/ui/impl-trait/issue-72911.stderr
index 0e86561aa277..063b7f68dc02 100644
--- a/tests/ui/impl-trait/issue-72911.stderr
+++ b/tests/ui/impl-trait/issue-72911.stderr
@@ -1,14 +1,18 @@
-error[E0433]: failed to resolve: use of undeclared crate or module `foo`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `foo`
--> $DIR/issue-72911.rs:11:33
|
LL | fn gather_from_file(dir_entry: &foo::MissingItem) -> impl Iterator
- {
- | ^^^ use of undeclared crate or module `foo`
+ | ^^^ use of unresolved module or unlinked crate `foo`
+ |
+ = help: you might be missing a crate named `foo`
-error[E0433]: failed to resolve: use of undeclared crate or module `foo`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `foo`
--> $DIR/issue-72911.rs:16:41
|
LL | fn lint_files() -> impl Iterator
- {
- | ^^^ use of undeclared crate or module `foo`
+ | ^^^ use of unresolved module or unlinked crate `foo`
+ |
+ = help: you might be missing a crate named `foo`
error: aborting due to 2 previous errors
diff --git a/tests/ui/impl-trait/stashed-diag-issue-121504.rs b/tests/ui/impl-trait/stashed-diag-issue-121504.rs
index 4ac8ffe8931c..84686ba4f7d3 100644
--- a/tests/ui/impl-trait/stashed-diag-issue-121504.rs
+++ b/tests/ui/impl-trait/stashed-diag-issue-121504.rs
@@ -4,7 +4,7 @@ trait MyTrait {
async fn foo(self) -> (Self, i32);
}
-impl MyTrait for xyz::T { //~ ERROR failed to resolve: use of undeclared crate or module `xyz`
+impl MyTrait for xyz::T { //~ ERROR failed to resolve: use of unresolved module or unlinked crate `xyz`
async fn foo(self, key: i32) -> (u32, i32) {
(self, key)
}
diff --git a/tests/ui/impl-trait/stashed-diag-issue-121504.stderr b/tests/ui/impl-trait/stashed-diag-issue-121504.stderr
index 6a881dc7f9fb..41c6cc425558 100644
--- a/tests/ui/impl-trait/stashed-diag-issue-121504.stderr
+++ b/tests/ui/impl-trait/stashed-diag-issue-121504.stderr
@@ -1,8 +1,10 @@
-error[E0433]: failed to resolve: use of undeclared crate or module `xyz`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `xyz`
--> $DIR/stashed-diag-issue-121504.rs:7:18
|
LL | impl MyTrait for xyz::T {
- | ^^^ use of undeclared crate or module `xyz`
+ | ^^^ use of unresolved module or unlinked crate `xyz`
+ |
+ = help: you might be missing a crate named `xyz`
error: aborting due to 1 previous error
diff --git a/tests/ui/imports/extern-prelude-extern-crate-fail.rs b/tests/ui/imports/extern-prelude-extern-crate-fail.rs
index 2f018851d193..84751ecc02b6 100644
--- a/tests/ui/imports/extern-prelude-extern-crate-fail.rs
+++ b/tests/ui/imports/extern-prelude-extern-crate-fail.rs
@@ -7,7 +7,7 @@ mod n {
mod m {
fn check() {
- two_macros::m!(); //~ ERROR failed to resolve: use of undeclared crate or module `two_macros`
+ two_macros::m!(); //~ ERROR failed to resolve: use of unresolved module or unlinked crate `two_macros`
}
}
diff --git a/tests/ui/imports/extern-prelude-extern-crate-fail.stderr b/tests/ui/imports/extern-prelude-extern-crate-fail.stderr
index f7e37449eebe..ec53730afa02 100644
--- a/tests/ui/imports/extern-prelude-extern-crate-fail.stderr
+++ b/tests/ui/imports/extern-prelude-extern-crate-fail.stderr
@@ -9,11 +9,11 @@ LL | define_std_as_non_existent!();
|
= note: this error originates in the macro `define_std_as_non_existent` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0433]: failed to resolve: use of undeclared crate or module `two_macros`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `two_macros`
--> $DIR/extern-prelude-extern-crate-fail.rs:10:9
|
LL | two_macros::m!();
- | ^^^^^^^^^^ use of undeclared crate or module `two_macros`
+ | ^^^^^^^^^^ use of unresolved module or unlinked crate `two_macros`
error: aborting due to 2 previous errors
diff --git a/tests/ui/imports/import-from-missing-star-2.stderr b/tests/ui/imports/import-from-missing-star-2.stderr
index dd35627c6846..9fe2bdbcfa27 100644
--- a/tests/ui/imports/import-from-missing-star-2.stderr
+++ b/tests/ui/imports/import-from-missing-star-2.stderr
@@ -2,9 +2,9 @@ error[E0432]: unresolved import `spam`
--> $DIR/import-from-missing-star-2.rs:2:9
|
LL | use spam::*;
- | ^^^^ you might be missing crate `spam`
+ | ^^^^ use of unresolved module or unlinked crate `spam`
|
-help: consider importing the `spam` crate
+help: you might be missing a crate named `spam`, add it to your project and import it in your code
|
LL + extern crate spam;
|
diff --git a/tests/ui/imports/import-from-missing-star-3.stderr b/tests/ui/imports/import-from-missing-star-3.stderr
index 1e2412b09597..c0b2e5675d39 100644
--- a/tests/ui/imports/import-from-missing-star-3.stderr
+++ b/tests/ui/imports/import-from-missing-star-3.stderr
@@ -2,9 +2,9 @@ error[E0432]: unresolved import `spam`
--> $DIR/import-from-missing-star-3.rs:2:9
|
LL | use spam::*;
- | ^^^^ you might be missing crate `spam`
+ | ^^^^ use of unresolved module or unlinked crate `spam`
|
-help: consider importing the `spam` crate
+help: you might be missing a crate named `spam`, add it to your project and import it in your code
|
LL + extern crate spam;
|
@@ -13,9 +13,9 @@ error[E0432]: unresolved import `spam`
--> $DIR/import-from-missing-star-3.rs:27:13
|
LL | use spam::*;
- | ^^^^ you might be missing crate `spam`
+ | ^^^^ use of unresolved module or unlinked crate `spam`
|
-help: consider importing the `spam` crate
+help: you might be missing a crate named `spam`, add it to your project and import it in your code
|
LL + extern crate spam;
|
diff --git a/tests/ui/imports/import-from-missing-star.stderr b/tests/ui/imports/import-from-missing-star.stderr
index c9bb9baeb4dd..768e1ea1e2cf 100644
--- a/tests/ui/imports/import-from-missing-star.stderr
+++ b/tests/ui/imports/import-from-missing-star.stderr
@@ -2,9 +2,9 @@ error[E0432]: unresolved import `spam`
--> $DIR/import-from-missing-star.rs:1:5
|
LL | use spam::*;
- | ^^^^ you might be missing crate `spam`
+ | ^^^^ use of unresolved module or unlinked crate `spam`
|
-help: consider importing the `spam` crate
+help: you might be missing a crate named `spam`, add it to your project and import it in your code
|
LL + extern crate spam;
|
diff --git a/tests/ui/imports/import3.stderr b/tests/ui/imports/import3.stderr
index 157b5b635668..7f5811467811 100644
--- a/tests/ui/imports/import3.stderr
+++ b/tests/ui/imports/import3.stderr
@@ -2,9 +2,9 @@ error[E0432]: unresolved import `main`
--> $DIR/import3.rs:2:5
|
LL | use main::bar;
- | ^^^^ you might be missing crate `main`
+ | ^^^^ use of unresolved module or unlinked crate `main`
|
-help: consider importing the `main` crate
+help: you might be missing a crate named `main`, add it to your project and import it in your code
|
LL + extern crate main;
|
diff --git a/tests/ui/imports/issue-109343.stderr b/tests/ui/imports/issue-109343.stderr
index e66528e8df52..e1071e45b924 100644
--- a/tests/ui/imports/issue-109343.stderr
+++ b/tests/ui/imports/issue-109343.stderr
@@ -2,9 +2,9 @@ error[E0432]: unresolved import `unresolved`
--> $DIR/issue-109343.rs:4:9
|
LL | pub use unresolved::f;
- | ^^^^^^^^^^ you might be missing crate `unresolved`
+ | ^^^^^^^^^^ use of unresolved module or unlinked crate `unresolved`
|
-help: consider importing the `unresolved` crate
+help: you might be missing a crate named `unresolved`, add it to your project and import it in your code
|
LL + extern crate unresolved;
|
diff --git a/tests/ui/imports/issue-1697.rs b/tests/ui/imports/issue-1697.rs
index 019237611df0..3d3d4a17d6c1 100644
--- a/tests/ui/imports/issue-1697.rs
+++ b/tests/ui/imports/issue-1697.rs
@@ -2,7 +2,7 @@
use unresolved::*;
//~^ ERROR unresolved import `unresolved` [E0432]
-//~| NOTE you might be missing crate `unresolved`
-//~| HELP consider importing the `unresolved` crate
+//~| NOTE use of unresolved module or unlinked crate `unresolved`
+//~| HELP you might be missing a crate named `unresolved`
fn main() {}
diff --git a/tests/ui/imports/issue-1697.stderr b/tests/ui/imports/issue-1697.stderr
index ec0d94bd672f..96e371c64f9e 100644
--- a/tests/ui/imports/issue-1697.stderr
+++ b/tests/ui/imports/issue-1697.stderr
@@ -2,9 +2,9 @@ error[E0432]: unresolved import `unresolved`
--> $DIR/issue-1697.rs:3:5
|
LL | use unresolved::*;
- | ^^^^^^^^^^ you might be missing crate `unresolved`
+ | ^^^^^^^^^^ use of unresolved module or unlinked crate `unresolved`
|
-help: consider importing the `unresolved` crate
+help: you might be missing a crate named `unresolved`, add it to your project and import it in your code
|
LL + extern crate unresolved;
|
diff --git a/tests/ui/imports/issue-33464.stderr b/tests/ui/imports/issue-33464.stderr
index 28fbcee401f9..dba451846758 100644
--- a/tests/ui/imports/issue-33464.stderr
+++ b/tests/ui/imports/issue-33464.stderr
@@ -2,9 +2,9 @@ error[E0432]: unresolved import `abc`
--> $DIR/issue-33464.rs:3:5
|
LL | use abc::one_el;
- | ^^^ you might be missing crate `abc`
+ | ^^^ use of unresolved module or unlinked crate `abc`
|
-help: consider importing the `abc` crate
+help: you might be missing a crate named `abc`, add it to your project and import it in your code
|
LL + extern crate abc;
|
@@ -13,9 +13,9 @@ error[E0432]: unresolved import `abc`
--> $DIR/issue-33464.rs:5:5
|
LL | use abc::{a, bbb, cccccc};
- | ^^^ you might be missing crate `abc`
+ | ^^^ use of unresolved module or unlinked crate `abc`
|
-help: consider importing the `abc` crate
+help: you might be missing a crate named `abc`, add it to your project and import it in your code
|
LL + extern crate abc;
|
@@ -24,9 +24,9 @@ error[E0432]: unresolved import `a_very_long_name`
--> $DIR/issue-33464.rs:7:5
|
LL | use a_very_long_name::{el, el2};
- | ^^^^^^^^^^^^^^^^ you might be missing crate `a_very_long_name`
+ | ^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `a_very_long_name`
|
-help: consider importing the `a_very_long_name` crate
+help: you might be missing a crate named `a_very_long_name`, add it to your project and import it in your code
|
LL + extern crate a_very_long_name;
|
diff --git a/tests/ui/imports/issue-36881.stderr b/tests/ui/imports/issue-36881.stderr
index 004836e072c5..33d628f40da2 100644
--- a/tests/ui/imports/issue-36881.stderr
+++ b/tests/ui/imports/issue-36881.stderr
@@ -2,9 +2,9 @@ error[E0432]: unresolved import `issue_36881_aux`
--> $DIR/issue-36881.rs:5:9
|
LL | use issue_36881_aux::Foo;
- | ^^^^^^^^^^^^^^^ you might be missing crate `issue_36881_aux`
+ | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `issue_36881_aux`
|
-help: consider importing the `issue_36881_aux` crate
+help: you might be missing a crate named `issue_36881_aux`, add it to your project and import it in your code
|
LL + extern crate issue_36881_aux;
|
diff --git a/tests/ui/imports/issue-37887.stderr b/tests/ui/imports/issue-37887.stderr
index cc191a17c293..b83ba273a019 100644
--- a/tests/ui/imports/issue-37887.stderr
+++ b/tests/ui/imports/issue-37887.stderr
@@ -2,9 +2,9 @@ error[E0432]: unresolved import `test`
--> $DIR/issue-37887.rs:3:9
|
LL | use test::*;
- | ^^^^ you might be missing crate `test`
+ | ^^^^ use of unresolved module or unlinked crate `test`
|
-help: consider importing the `test` crate
+help: you might be missing a crate named `test`, add it to your project and import it in your code
|
LL + extern crate test;
|
diff --git a/tests/ui/imports/issue-53269.stderr b/tests/ui/imports/issue-53269.stderr
index d25d85bf46f0..c12fc0f378e8 100644
--- a/tests/ui/imports/issue-53269.stderr
+++ b/tests/ui/imports/issue-53269.stderr
@@ -2,9 +2,9 @@ error[E0432]: unresolved import `nonexistent_module`
--> $DIR/issue-53269.rs:6:9
|
LL | use nonexistent_module::mac;
- | ^^^^^^^^^^^^^^^^^^ you might be missing crate `nonexistent_module`
+ | ^^^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `nonexistent_module`
|
-help: consider importing the `nonexistent_module` crate
+help: you might be missing a crate named `nonexistent_module`, add it to your project and import it in your code
|
LL + extern crate nonexistent_module;
|
diff --git a/tests/ui/imports/issue-55457.stderr b/tests/ui/imports/issue-55457.stderr
index 9c99b6a20de7..472e46caf31e 100644
--- a/tests/ui/imports/issue-55457.stderr
+++ b/tests/ui/imports/issue-55457.stderr
@@ -11,9 +11,9 @@ error[E0432]: unresolved import `non_existent`
--> $DIR/issue-55457.rs:2:5
|
LL | use non_existent::non_existent;
- | ^^^^^^^^^^^^ you might be missing crate `non_existent`
+ | ^^^^^^^^^^^^ use of unresolved module or unlinked crate `non_existent`
|
-help: consider importing the `non_existent` crate
+help: you might be missing a crate named `non_existent`, add it to your project and import it in your code
|
LL + extern crate non_existent;
|
diff --git a/tests/ui/imports/issue-81413.stderr b/tests/ui/imports/issue-81413.stderr
index aa1246c1d2f5..257aca4455c5 100644
--- a/tests/ui/imports/issue-81413.stderr
+++ b/tests/ui/imports/issue-81413.stderr
@@ -2,9 +2,9 @@ error[E0432]: unresolved import `doesnt_exist`
--> $DIR/issue-81413.rs:7:9
|
LL | pub use doesnt_exist::*;
- | ^^^^^^^^^^^^ you might be missing crate `doesnt_exist`
+ | ^^^^^^^^^^^^ use of unresolved module or unlinked crate `doesnt_exist`
|
-help: consider importing the `doesnt_exist` crate
+help: you might be missing a crate named `doesnt_exist`, add it to your project and import it in your code
|
LL + extern crate doesnt_exist;
|
diff --git a/tests/ui/imports/tool-mod-child.rs b/tests/ui/imports/tool-mod-child.rs
index a8249ab01dfc..38bcdfb02494 100644
--- a/tests/ui/imports/tool-mod-child.rs
+++ b/tests/ui/imports/tool-mod-child.rs
@@ -1,7 +1,7 @@
use clippy::a; //~ ERROR unresolved import `clippy`
-use clippy::a::b; //~ ERROR failed to resolve: you might be missing crate `clippy`
+use clippy::a::b; //~ ERROR failed to resolve: use of unresolved module or unlinked crate `clippy`
use rustdoc::a; //~ ERROR unresolved import `rustdoc`
-use rustdoc::a::b; //~ ERROR failed to resolve: you might be missing crate `rustdoc`
+use rustdoc::a::b; //~ ERROR failed to resolve: use of unresolved module or unlinked crate `rustdoc`
fn main() {}
diff --git a/tests/ui/imports/tool-mod-child.stderr b/tests/ui/imports/tool-mod-child.stderr
index ec110ccd75db..b0e446fcbf6a 100644
--- a/tests/ui/imports/tool-mod-child.stderr
+++ b/tests/ui/imports/tool-mod-child.stderr
@@ -1,10 +1,10 @@
-error[E0433]: failed to resolve: you might be missing crate `clippy`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `clippy`
--> $DIR/tool-mod-child.rs:2:5
|
LL | use clippy::a::b;
- | ^^^^^^ you might be missing crate `clippy`
+ | ^^^^^^ use of unresolved module or unlinked crate `clippy`
|
-help: consider importing the `clippy` crate
+help: you might be missing a crate named `clippy`, add it to your project and import it in your code
|
LL + extern crate clippy;
|
@@ -13,20 +13,20 @@ error[E0432]: unresolved import `clippy`
--> $DIR/tool-mod-child.rs:1:5
|
LL | use clippy::a;
- | ^^^^^^ you might be missing crate `clippy`
+ | ^^^^^^ use of unresolved module or unlinked crate `clippy`
|
-help: consider importing the `clippy` crate
+help: you might be missing a crate named `clippy`, add it to your project and import it in your code
|
LL + extern crate clippy;
|
-error[E0433]: failed to resolve: you might be missing crate `rustdoc`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `rustdoc`
--> $DIR/tool-mod-child.rs:5:5
|
LL | use rustdoc::a::b;
- | ^^^^^^^ you might be missing crate `rustdoc`
+ | ^^^^^^^ use of unresolved module or unlinked crate `rustdoc`
|
-help: consider importing the `rustdoc` crate
+help: you might be missing a crate named `rustdoc`, add it to your project and import it in your code
|
LL + extern crate rustdoc;
|
@@ -35,9 +35,9 @@ error[E0432]: unresolved import `rustdoc`
--> $DIR/tool-mod-child.rs:4:5
|
LL | use rustdoc::a;
- | ^^^^^^^ you might be missing crate `rustdoc`
+ | ^^^^^^^ use of unresolved module or unlinked crate `rustdoc`
|
-help: consider importing the `rustdoc` crate
+help: you might be missing a crate named `rustdoc`, add it to your project and import it in your code
|
LL + extern crate rustdoc;
|
diff --git a/tests/ui/imports/unresolved-imports-used.stderr b/tests/ui/imports/unresolved-imports-used.stderr
index 4bf02ff6e3a9..d39d26852171 100644
--- a/tests/ui/imports/unresolved-imports-used.stderr
+++ b/tests/ui/imports/unresolved-imports-used.stderr
@@ -14,9 +14,9 @@ error[E0432]: unresolved import `foo`
--> $DIR/unresolved-imports-used.rs:11:5
|
LL | use foo::bar;
- | ^^^ you might be missing crate `foo`
+ | ^^^ use of unresolved module or unlinked crate `foo`
|
-help: consider importing the `foo` crate
+help: you might be missing a crate named `foo`, add it to your project and import it in your code
|
LL + extern crate foo;
|
@@ -25,9 +25,9 @@ error[E0432]: unresolved import `baz`
--> $DIR/unresolved-imports-used.rs:12:5
|
LL | use baz::*;
- | ^^^ you might be missing crate `baz`
+ | ^^^ use of unresolved module or unlinked crate `baz`
|
-help: consider importing the `baz` crate
+help: you might be missing a crate named `baz`, add it to your project and import it in your code
|
LL + extern crate baz;
|
@@ -36,9 +36,9 @@ error[E0432]: unresolved import `foo2`
--> $DIR/unresolved-imports-used.rs:14:5
|
LL | use foo2::bar2;
- | ^^^^ you might be missing crate `foo2`
+ | ^^^^ use of unresolved module or unlinked crate `foo2`
|
-help: consider importing the `foo2` crate
+help: you might be missing a crate named `foo2`, add it to your project and import it in your code
|
LL + extern crate foo2;
|
@@ -47,9 +47,9 @@ error[E0432]: unresolved import `baz2`
--> $DIR/unresolved-imports-used.rs:15:5
|
LL | use baz2::*;
- | ^^^^ you might be missing crate `baz2`
+ | ^^^^ use of unresolved module or unlinked crate `baz2`
|
-help: consider importing the `baz2` crate
+help: you might be missing a crate named `baz2`, add it to your project and import it in your code
|
LL + extern crate baz2;
|
diff --git a/tests/ui/issues/issue-22370.stderr b/tests/ui/issues/issue-22370.stderr
index 3dc060963f92..b02d867eb7dd 100644
--- a/tests/ui/issues/issue-22370.stderr
+++ b/tests/ui/issues/issue-22370.stderr
@@ -7,7 +7,7 @@ LL |
LL | fn f(a: &dyn A) {}
| ^
|
- = note: because of the default `Self` reference, type parameters must be specified on object types
+ = note: because the parameter default references `Self`, the parameter must be specified on the object type
help: set the type parameter to the desired type
|
LL | fn f(a: &dyn A) {}
diff --git a/tests/ui/issues/issue-33293.rs b/tests/ui/issues/issue-33293.rs
index a6ef007d51fb..115ae3aad204 100644
--- a/tests/ui/issues/issue-33293.rs
+++ b/tests/ui/issues/issue-33293.rs
@@ -1,6 +1,6 @@
fn main() {
match 0 {
aaa::bbb(_) => ()
- //~^ ERROR failed to resolve: use of undeclared crate or module `aaa`
+ //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `aaa`
};
}
diff --git a/tests/ui/issues/issue-33293.stderr b/tests/ui/issues/issue-33293.stderr
index 5badaa153f2b..a82813194d77 100644
--- a/tests/ui/issues/issue-33293.stderr
+++ b/tests/ui/issues/issue-33293.stderr
@@ -1,8 +1,10 @@
-error[E0433]: failed to resolve: use of undeclared crate or module `aaa`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `aaa`
--> $DIR/issue-33293.rs:3:9
|
LL | aaa::bbb(_) => ()
- | ^^^ use of undeclared crate or module `aaa`
+ | ^^^ use of unresolved module or unlinked crate `aaa`
+ |
+ = help: you might be missing a crate named `aaa`
error: aborting due to 1 previous error
diff --git a/tests/ui/keyword/extern/keyword-extern-as-identifier-use.stderr b/tests/ui/keyword/extern/keyword-extern-as-identifier-use.stderr
index f23f855c9e8e..dab68258a472 100644
--- a/tests/ui/keyword/extern/keyword-extern-as-identifier-use.stderr
+++ b/tests/ui/keyword/extern/keyword-extern-as-identifier-use.stderr
@@ -13,9 +13,9 @@ error[E0432]: unresolved import `r#extern`
--> $DIR/keyword-extern-as-identifier-use.rs:1:5
|
LL | use extern::foo;
- | ^^^^^^ you might be missing crate `r#extern`
+ | ^^^^^^ use of unresolved module or unlinked crate `r#extern`
|
-help: consider importing the `r#extern` crate
+help: you might be missing a crate named `r#extern`, add it to your project and import it in your code
|
LL + extern crate r#extern;
|
diff --git a/tests/ui/lint/linker-warning-bin.rs b/tests/ui/lint/linker-warning-bin.rs
new file mode 100644
index 000000000000..ead0aa002bf2
--- /dev/null
+++ b/tests/ui/lint/linker-warning-bin.rs
@@ -0,0 +1,6 @@
+//@ build-pass
+#![crate_type = "bin"]
+#![warn(unused_attributes)]
+#![allow(linker_messages)]
+
+fn main() {}
diff --git a/tests/ui/lint/linker-warning.rs b/tests/ui/lint/linker-warning.rs
new file mode 100644
index 000000000000..10e3f56ab959
--- /dev/null
+++ b/tests/ui/lint/linker-warning.rs
@@ -0,0 +1,9 @@
+//@ check-pass
+#![crate_type = "lib"]
+#![warn(unused_attributes)]
+#![allow(linker_messages)]
+//~^ WARNING unused attribute
+
+#[allow(linker_messages)]
+//~^ WARNING should be an inner attribute
+fn foo() {}
diff --git a/tests/ui/lint/linker-warning.stderr b/tests/ui/lint/linker-warning.stderr
new file mode 100644
index 000000000000..3a2c392fd031
--- /dev/null
+++ b/tests/ui/lint/linker-warning.stderr
@@ -0,0 +1,22 @@
+warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+ --> $DIR/linker-warning.rs:7:1
+ |
+LL | #[allow(linker_messages)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: the lint level is defined here
+ --> $DIR/linker-warning.rs:3:9
+ |
+LL | #![warn(unused_attributes)]
+ | ^^^^^^^^^^^^^^^^^
+
+warning: unused attribute
+ --> $DIR/linker-warning.rs:4:1
+ |
+LL | #![allow(linker_messages)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+ |
+ = note: the `linker_warnings` lint can only be controlled at the root of a crate that needs to be linked
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/macros/builtin-prelude-no-accidents.rs b/tests/ui/macros/builtin-prelude-no-accidents.rs
index 01691a82dd77..9bebcb75526f 100644
--- a/tests/ui/macros/builtin-prelude-no-accidents.rs
+++ b/tests/ui/macros/builtin-prelude-no-accidents.rs
@@ -2,7 +2,7 @@
// because macros with the same names are in prelude.
fn main() {
- env::current_dir; //~ ERROR use of undeclared crate or module `env`
- type A = panic::PanicInfo; //~ ERROR use of undeclared crate or module `panic`
- type B = vec::Vec; //~ ERROR use of undeclared crate or module `vec`
+ env::current_dir; //~ ERROR use of unresolved module or unlinked crate `env`
+ type A = panic::PanicInfo; //~ ERROR use of unresolved module or unlinked crate `panic`
+ type B = vec::Vec; //~ ERROR use of unresolved module or unlinked crate `vec`
}
diff --git a/tests/ui/macros/builtin-prelude-no-accidents.stderr b/tests/ui/macros/builtin-prelude-no-accidents.stderr
index c1054230bc9a..8c7095a6aedf 100644
--- a/tests/ui/macros/builtin-prelude-no-accidents.stderr
+++ b/tests/ui/macros/builtin-prelude-no-accidents.stderr
@@ -1,31 +1,34 @@
-error[E0433]: failed to resolve: use of undeclared crate or module `env`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `env`
--> $DIR/builtin-prelude-no-accidents.rs:5:5
|
LL | env::current_dir;
- | ^^^ use of undeclared crate or module `env`
+ | ^^^ use of unresolved module or unlinked crate `env`
|
+ = help: you might be missing a crate named `env`
help: consider importing this module
|
LL + use std::env;
|
-error[E0433]: failed to resolve: use of undeclared crate or module `panic`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `panic`
--> $DIR/builtin-prelude-no-accidents.rs:6:14
|
LL | type A = panic::PanicInfo;
- | ^^^^^ use of undeclared crate or module `panic`
+ | ^^^^^ use of unresolved module or unlinked crate `panic`
|
+ = help: you might be missing a crate named `panic`
help: consider importing this module
|
LL + use std::panic;
|
-error[E0433]: failed to resolve: use of undeclared crate or module `vec`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `vec`
--> $DIR/builtin-prelude-no-accidents.rs:7:14
|
LL | type B = vec::Vec;
- | ^^^ use of undeclared crate or module `vec`
+ | ^^^ use of unresolved module or unlinked crate `vec`
|
+ = help: you might be missing a crate named `vec`
help: consider importing this module
|
LL + use std::vec;
diff --git a/tests/ui/macros/macro-inner-attributes.rs b/tests/ui/macros/macro-inner-attributes.rs
index 6dbfce213598..a1eb7cd15c4c 100644
--- a/tests/ui/macros/macro-inner-attributes.rs
+++ b/tests/ui/macros/macro-inner-attributes.rs
@@ -15,6 +15,6 @@ test!(b,
#[rustc_dummy]
fn main() {
a::bar();
- //~^ ERROR failed to resolve: use of undeclared crate or module `a`
+ //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `a`
b::bar();
}
diff --git a/tests/ui/macros/macro-inner-attributes.stderr b/tests/ui/macros/macro-inner-attributes.stderr
index b6e10f45e381..947e33b08f4a 100644
--- a/tests/ui/macros/macro-inner-attributes.stderr
+++ b/tests/ui/macros/macro-inner-attributes.stderr
@@ -1,8 +1,8 @@
-error[E0433]: failed to resolve: use of undeclared crate or module `a`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `a`
--> $DIR/macro-inner-attributes.rs:17:5
|
LL | a::bar();
- | ^ use of undeclared crate or module `a`
+ | ^ use of unresolved module or unlinked crate `a`
|
help: there is a crate or module with a similar name
|
diff --git a/tests/ui/macros/macro_path_as_generic_bound.stderr b/tests/ui/macros/macro_path_as_generic_bound.stderr
index e25ff57e57f3..9fe4ad27aa05 100644
--- a/tests/ui/macros/macro_path_as_generic_bound.stderr
+++ b/tests/ui/macros/macro_path_as_generic_bound.stderr
@@ -1,8 +1,10 @@
-error[E0433]: failed to resolve: use of undeclared crate or module `m`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `m`
--> $DIR/macro_path_as_generic_bound.rs:7:6
|
LL | foo!(m::m2::A);
- | ^ use of undeclared crate or module `m`
+ | ^ use of unresolved module or unlinked crate `m`
+ |
+ = help: you might be missing a crate named `m`
error: aborting due to 1 previous error
diff --git a/tests/ui/macros/meta-item-absolute-path.stderr b/tests/ui/macros/meta-item-absolute-path.stderr
index af56d935284c..8fa5e97899ca 100644
--- a/tests/ui/macros/meta-item-absolute-path.stderr
+++ b/tests/ui/macros/meta-item-absolute-path.stderr
@@ -1,14 +1,14 @@
-error[E0433]: failed to resolve: you might be missing crate `Absolute`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `Absolute`
--> $DIR/meta-item-absolute-path.rs:1:12
|
LL | #[derive(::Absolute)]
- | ^^^^^^^^ you might be missing crate `Absolute`
+ | ^^^^^^^^ use of unresolved module or unlinked crate `Absolute`
-error[E0433]: failed to resolve: you might be missing crate `Absolute`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `Absolute`
--> $DIR/meta-item-absolute-path.rs:1:12
|
LL | #[derive(::Absolute)]
- | ^^^^^^^^ you might be missing crate `Absolute`
+ | ^^^^^^^^ use of unresolved module or unlinked crate `Absolute`
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
diff --git a/tests/ui/mir/issue-121103.rs b/tests/ui/mir/issue-121103.rs
index e06361a6964c..247c644c5bb1 100644
--- a/tests/ui/mir/issue-121103.rs
+++ b/tests/ui/mir/issue-121103.rs
@@ -1,3 +1,3 @@
fn main(_: as lib2::TypeFn>::Output) {}
-//~^ ERROR failed to resolve: use of undeclared crate or module `lib2`
-//~| ERROR failed to resolve: use of undeclared crate or module `lib2`
+//~^ ERROR failed to resolve: use of unresolved module or unlinked crate `lib2`
+//~| ERROR failed to resolve: use of unresolved module or unlinked crate `lib2`
diff --git a/tests/ui/mir/issue-121103.stderr b/tests/ui/mir/issue-121103.stderr
index 913eee9e0c50..3565f6f0cdef 100644
--- a/tests/ui/mir/issue-121103.stderr
+++ b/tests/ui/mir/issue-121103.stderr
@@ -1,14 +1,18 @@
-error[E0433]: failed to resolve: use of undeclared crate or module `lib2`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `lib2`
--> $DIR/issue-121103.rs:1:38
|
LL | fn main(_: as lib2::TypeFn>::Output) {}
- | ^^^^ use of undeclared crate or module `lib2`
+ | ^^^^ use of unresolved module or unlinked crate `lib2`
+ |
+ = help: you might be missing a crate named `lib2`
-error[E0433]: failed to resolve: use of undeclared crate or module `lib2`
+error[E0433]: failed to resolve: use of unresolved module or unlinked crate `lib2`
--> $DIR/issue-121103.rs:1:13
|
LL | fn main(_: