diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs index c082a82306848..49d38e05c8b06 100644 --- a/compiler/rustc_codegen_llvm/src/builder.rs +++ b/compiler/rustc_codegen_llvm/src/builder.rs @@ -16,7 +16,6 @@ use rustc_codegen_ssa::mir::place::PlaceRef; use rustc_codegen_ssa::traits::*; use rustc_data_structures::small_c_str::SmallCStr; use rustc_hir::def_id::DefId; -use rustc_middle::bug; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs; use rustc_middle::ty::layout::{ FnAbiError, FnAbiOfHelpers, FnAbiRequest, HasTypingEnv, LayoutError, LayoutOfHelpers, @@ -1458,10 +1457,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { match &fn_abi.ret.mode { PassMode::Ignore | PassMode::Indirect { .. } => self.ret_void(), - PassMode::Direct(_) | PassMode::Pair { .. } => self.ret(call), - mode @ PassMode::Cast { .. } => { - bug!("Encountered `PassMode::{mode:?}` during codegen") - } + PassMode::Direct(_) | PassMode::Pair { .. } | PassMode::Cast { .. } => self.ret(call), } } diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs index 5bc18e2d7f8bb..d9ba5017a422d 100644 --- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs @@ -51,15 +51,7 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap = tcx .reachable_set(()) @@ -104,11 +96,12 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap, _: LocalCrate) -> DefIdMap> FunctionCx<'a, 'tcx, Bx> { let return_dest = self.make_return_dest(bx, destination, &fn_abi.ret, &mut llargs); target.map(|target| (return_dest, target)) } - CallKind::Tail => None, + CallKind::Tail => { + if fn_abi.ret.is_indirect() { + match self.make_return_dest(bx, destination, &fn_abi.ret, &mut llargs) { + ReturnDest::Nothing => {} + _ => bug!( + "tail calls to functions with indirect returns cannot store into a destination" + ), + } + } + None + } }; // Split the rust-call tupled arguments off. diff --git a/compiler/rustc_infer/src/traits/project.rs b/compiler/rustc_infer/src/traits/project.rs index 9082db4f4488c..9dd35b6de3080 100644 --- a/compiler/rustc_infer/src/traits/project.rs +++ b/compiler/rustc_infer/src/traits/project.rs @@ -2,6 +2,7 @@ use rustc_data_structures::snapshot_map::{self, SnapshotMapRef, SnapshotMapStorage}; use rustc_data_structures::undo_log::Rollback; +use rustc_macros::TypeVisitable; use rustc_middle::traits::EvaluationResult; use rustc_middle::ty; use tracing::{debug, info}; @@ -12,7 +13,7 @@ use crate::infer::snapshot::undo_log::InferCtxtUndoLogs; pub(crate) type UndoLog<'tcx> = snapshot_map::UndoLog, ProjectionCacheEntry<'tcx>>; -#[derive(Clone)] +#[derive(Clone, TypeVisitable)] pub struct MismatchedProjectionTypes<'tcx> { pub err: ty::error::TypeError<'tcx>, } diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 30d4cc8b3c8d6..db2e252f9406a 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -397,7 +397,10 @@ rustc_queries! { /// The root query triggering all analysis passes like typeck or borrowck. query analysis(key: ()) { eval_always - desc { "running analysis passes on this crate" } + desc { |tcx| + "running analysis passes on crate `{}`", + tcx.crate_name(LOCAL_CRATE), + } } /// This query checks the fulfillment of collected lint expectations. diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs index 8e4c7cec0dcf0..b98547c42789d 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs @@ -20,7 +20,7 @@ use rustc_infer::traits::{ PredicateObligation, SelectionError, }; use rustc_middle::ty::print::{PrintTraitRefExt as _, with_no_trimmed_paths}; -use rustc_middle::ty::{self, Ty, TyCtxt}; +use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt as _}; use rustc_span::{DesugaringKind, ErrorGuaranteed, ExpnKind, Span}; use tracing::{info, instrument}; @@ -253,7 +253,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { for from_expansion in [false, true] { for (error, suppressed) in iter::zip(&errors, &is_suppressed) { - if !suppressed && error.obligation.cause.span.from_expansion() == from_expansion { + if !suppressed + && error.obligation.cause.span.from_expansion() == from_expansion + && !error.references_error() + { let guar = self.report_fulfillment_error(error); self.infcx.set_tainted_by_errors(guar); reported = Some(guar); diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs index 0f3b38ef66751..308d533e68991 100644 --- a/compiler/rustc_trait_selection/src/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/mod.rs @@ -29,6 +29,7 @@ use std::ops::ControlFlow; use rustc_errors::ErrorGuaranteed; use rustc_hir::def::DefKind; pub use rustc_infer::traits::*; +use rustc_macros::TypeVisitable; use rustc_middle::query::Providers; use rustc_middle::span_bug; use rustc_middle::ty::error::{ExpectedFound, TypeError}; @@ -75,7 +76,7 @@ use crate::infer::{InferCtxt, TyCtxtInferExt}; use crate::regions::InferCtxtRegionExt; use crate::traits::query::evaluate_obligation::InferCtxtExt as _; -#[derive(Debug)] +#[derive(Debug, TypeVisitable)] pub struct FulfillmentError<'tcx> { pub obligation: PredicateObligation<'tcx>, pub code: FulfillmentErrorCode<'tcx>, @@ -107,7 +108,7 @@ impl<'tcx> FulfillmentError<'tcx> { } } -#[derive(Clone)] +#[derive(Clone, TypeVisitable)] pub enum FulfillmentErrorCode<'tcx> { /// Inherently impossible to fulfill; this trait is implemented if and only /// if it is already implemented. diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index e1b3ff92a07b8..924fe478650f1 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -29,6 +29,7 @@ use crate::core::builder::{ }; use crate::core::config::TargetSelection; use crate::core::config::flags::{Subcommand, get_completion, top_level_help}; +use crate::core::debuggers; use crate::utils::build_stamp::{self, BuildStamp}; use crate::utils::exec::{BootstrapCommand, command}; use crate::utils::helpers::{ @@ -38,8 +39,6 @@ use crate::utils::helpers::{ use crate::utils::render_tests::{add_flags_and_try_run_tests, try_run_tests}; use crate::{CLang, CodegenBackendKind, DocTests, GitRepo, Mode, PathSet, envify}; -const ADB_TEST_DIR: &str = "/data/local/tmp/work"; - /// Runs `cargo test` on various internal tools used by bootstrap. #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct CrateBootstrap { @@ -2078,27 +2077,24 @@ Please disable assertions with `rust.debug-assertions = false`. cmd.arg("--python").arg(builder.python()); - if let Some(ref gdb) = builder.config.gdb { - cmd.arg("--gdb").arg(gdb); - } - - let lldb_exe = builder.config.lldb.clone().unwrap_or_else(|| PathBuf::from("lldb")); - let lldb_version = command(&lldb_exe) - .allow_failure() - .arg("--version") - .run_capture(builder) - .stdout_if_ok() - .and_then(|v| if v.trim().is_empty() { None } else { Some(v) }); - if let Some(ref vers) = lldb_version { - cmd.arg("--lldb-version").arg(vers); - let lldb_python_dir = command(&lldb_exe) - .allow_failure() - .arg("-P") - .run_capture_stdout(builder) - .stdout_if_ok() - .map(|p| p.lines().next().expect("lldb Python dir not found").to_string()); - if let Some(ref dir) = lldb_python_dir { - cmd.arg("--lldb-python-dir").arg(dir); + if mode == "debuginfo" { + if let Some(debuggers::Gdb { gdb }) = debuggers::discover_gdb(builder) { + cmd.arg("--gdb").arg(gdb); + } + + if let Some(debuggers::Android { adb_path, adb_test_dir, android_cross_path }) = + debuggers::discover_android(builder, target) + { + cmd.arg("--adb-path").arg(adb_path); + cmd.arg("--adb-test-dir").arg(adb_test_dir); + cmd.arg("--android-cross-path").arg(android_cross_path); + } + + if let Some(debuggers::Lldb { lldb_version, lldb_python_dir }) = + debuggers::discover_lldb(builder) + { + cmd.arg("--lldb-version").arg(lldb_version); + cmd.arg("--lldb-python-dir").arg(lldb_python_dir); } } @@ -2332,16 +2328,6 @@ Please disable assertions with `rust.debug-assertions = false`. cmd.env("RUST_TEST_TMPDIR", builder.tempdir()); - cmd.arg("--adb-path").arg("adb"); - cmd.arg("--adb-test-dir").arg(ADB_TEST_DIR); - if target.contains("android") && !builder.config.dry_run() { - // Assume that cc for this target comes from the android sysroot - cmd.arg("--android-cross-path") - .arg(builder.cc(target).parent().unwrap().parent().unwrap()); - } else { - cmd.arg("--android-cross-path").arg(""); - } - if builder.config.cmd.rustfix_coverage() { cmd.arg("--rustfix-coverage"); } diff --git a/src/bootstrap/src/core/debuggers/android.rs b/src/bootstrap/src/core/debuggers/android.rs new file mode 100644 index 0000000000000..b1ad9ca555fbd --- /dev/null +++ b/src/bootstrap/src/core/debuggers/android.rs @@ -0,0 +1,24 @@ +use std::path::PathBuf; + +use crate::core::builder::Builder; +use crate::core::config::TargetSelection; + +pub(crate) struct Android { + pub(crate) adb_path: &'static str, + pub(crate) adb_test_dir: &'static str, + pub(crate) android_cross_path: PathBuf, +} + +pub(crate) fn discover_android(builder: &Builder<'_>, target: TargetSelection) -> Option { + let adb_path = "adb"; + // See . + let adb_test_dir = "/data/local/tmp/work"; + + let android_cross_path = if target.contains("android") && !builder.config.dry_run() { + builder.cc(target).parent().unwrap().parent().unwrap().to_owned() + } else { + PathBuf::new() + }; + + Some(Android { adb_path, adb_test_dir, android_cross_path }) +} diff --git a/src/bootstrap/src/core/debuggers/gdb.rs b/src/bootstrap/src/core/debuggers/gdb.rs new file mode 100644 index 0000000000000..ddad0909e4f07 --- /dev/null +++ b/src/bootstrap/src/core/debuggers/gdb.rs @@ -0,0 +1,13 @@ +use std::path::Path; + +use crate::core::builder::Builder; + +pub(crate) struct Gdb<'a> { + pub(crate) gdb: &'a Path, +} + +pub(crate) fn discover_gdb<'a>(builder: &'a Builder<'_>) -> Option> { + let gdb = builder.config.gdb.as_deref()?; + + Some(Gdb { gdb }) +} diff --git a/src/bootstrap/src/core/debuggers/lldb.rs b/src/bootstrap/src/core/debuggers/lldb.rs new file mode 100644 index 0000000000000..66ab45573d6bb --- /dev/null +++ b/src/bootstrap/src/core/debuggers/lldb.rs @@ -0,0 +1,32 @@ +use std::path::PathBuf; + +use crate::core::builder::Builder; +use crate::utils::exec::command; + +pub(crate) struct Lldb { + pub(crate) lldb_version: String, + pub(crate) lldb_python_dir: String, +} + +pub(crate) fn discover_lldb(builder: &Builder<'_>) -> Option { + // FIXME(#148361): We probably should not be picking up whatever arbitrary + // lldb happens to be in the user's path, and instead require some kind of + // explicit opt-in or configuration. + let lldb_exe = builder.config.lldb.clone().unwrap_or_else(|| PathBuf::from("lldb")); + + let lldb_version = command(&lldb_exe) + .allow_failure() + .arg("--version") + .run_capture(builder) + .stdout_if_ok() + .and_then(|v| if v.trim().is_empty() { None } else { Some(v) })?; + + let lldb_python_dir = command(&lldb_exe) + .allow_failure() + .arg("-P") + .run_capture_stdout(builder) + .stdout_if_ok() + .map(|p| p.lines().next().expect("lldb Python dir not found").to_string())?; + + Some(Lldb { lldb_version, lldb_python_dir }) +} diff --git a/src/bootstrap/src/core/debuggers/mod.rs b/src/bootstrap/src/core/debuggers/mod.rs new file mode 100644 index 0000000000000..011ce4081a43e --- /dev/null +++ b/src/bootstrap/src/core/debuggers/mod.rs @@ -0,0 +1,10 @@ +//! Code for discovering debuggers and debugger-related configuration, so that +//! it can be passed to compiletest when running debuginfo tests. + +pub(crate) use self::android::{Android, discover_android}; +pub(crate) use self::gdb::{Gdb, discover_gdb}; +pub(crate) use self::lldb::{Lldb, discover_lldb}; + +mod android; +mod gdb; +mod lldb; diff --git a/src/bootstrap/src/core/mod.rs b/src/bootstrap/src/core/mod.rs index 9e18d6704d4fe..f27a09c81c55b 100644 --- a/src/bootstrap/src/core/mod.rs +++ b/src/bootstrap/src/core/mod.rs @@ -1,6 +1,7 @@ pub(crate) mod build_steps; pub(crate) mod builder; pub(crate) mod config; +pub(crate) mod debuggers; pub(crate) mod download; pub(crate) mod metadata; pub(crate) mod sanity; diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index 0d91095fbbb92..d0ad80a7f05d5 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -444,7 +444,7 @@ target | std | host | notes `x86_64-uwp-windows-gnu` | ✓ | | [`x86_64-uwp-windows-msvc`](platform-support/uwp-windows-msvc.md) | ✓ | | [`x86_64-win7-windows-gnu`](platform-support/win7-windows-gnu.md) | ✓ | | 64-bit Windows 7 support -[`x86_64-win7-windows-msvc`](platform-support/win7-windows-msvc.md) | ✓ | | 64-bit Windows 7 support +[`x86_64-win7-windows-msvc`](platform-support/win7-windows-msvc.md) | ✓ | ✓ | 64-bit Windows 7 support [`x86_64-wrs-vxworks`](platform-support/vxworks.md) | ✓ | | [`x86_64h-apple-darwin`](platform-support/x86_64h-apple-darwin.md) | ✓ | ✓ | macOS with late-gen Intel (at least Haswell) [`xtensa-esp32-espidf`](platform-support/esp-idf.md) | ✓ | | Xtensa ESP32 diff --git a/src/doc/rustc/src/platform-support/win7-windows-msvc.md b/src/doc/rustc/src/platform-support/win7-windows-msvc.md index 56fe0f6401664..b14424ddbf3a4 100644 --- a/src/doc/rustc/src/platform-support/win7-windows-msvc.md +++ b/src/doc/rustc/src/platform-support/win7-windows-msvc.md @@ -16,7 +16,8 @@ Target triples: This target supports all of core, alloc, std and test. This is automatically tested every night on private infrastructure hosted by the maintainer. Host -tools may also work, though those are not currently tested. +tools may also work, though it is not guaranteed. Last known success built +version of rustc with host tools (x86_64) is 1.91.0. Those targets follow Windows calling convention for extern "C". diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 1f893fecb54b0..1f01d279310e0 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -560,7 +560,7 @@ pub struct Config { /// /// FIXME: take a look at this; this is piggy-backing off of gdb code paths but only for /// `arm-linux-androideabi` target. - pub android_cross_path: Utf8PathBuf, + pub android_cross_path: Option, /// Extra parameter to run adb on `arm-linux-androideabi`. /// diff --git a/src/tools/compiletest/src/debuggers.rs b/src/tools/compiletest/src/debuggers.rs index 8afe3289fa45a..e97352db9139c 100644 --- a/src/tools/compiletest/src/debuggers.rs +++ b/src/tools/compiletest/src/debuggers.rs @@ -103,22 +103,19 @@ fn find_cdb(target: &str) -> Option { } /// Returns Path to CDB -pub(crate) fn analyze_cdb( - cdb: Option, - target: &str, -) -> (Option, Option<[u16; 4]>) { +pub(crate) fn discover_cdb(cdb: Option, target: &str) -> Option { let cdb = cdb.map(Utf8PathBuf::from).or_else(|| find_cdb(target)); + cdb +} +pub(crate) fn query_cdb_version(cdb: &Utf8Path) -> Option<[u16; 4]> { let mut version = None; - if let Some(cdb) = cdb.as_ref() { - if let Ok(output) = Command::new(cdb).arg("/version").output() { - if let Some(first_line) = String::from_utf8_lossy(&output.stdout).lines().next() { - version = extract_cdb_version(&first_line); - } + if let Ok(output) = Command::new(cdb).arg("/version").output() { + if let Some(first_line) = String::from_utf8_lossy(&output.stdout).lines().next() { + version = extract_cdb_version(&first_line); } } - - (cdb, version) + version } pub(crate) fn extract_cdb_version(full_version_line: &str) -> Option<[u16; 4]> { @@ -132,12 +129,11 @@ pub(crate) fn extract_cdb_version(full_version_line: &str) -> Option<[u16; 4]> { Some([major, minor, patch, build]) } -/// Returns (Path to GDB, GDB Version) -pub(crate) fn analyze_gdb( +pub(crate) fn discover_gdb( gdb: Option, target: &str, - android_cross_path: &Utf8Path, -) -> (Option, Option) { + android_cross_path: Option<&Utf8Path>, +) -> Option { #[cfg(not(windows))] const GDB_FALLBACK: &str = "gdb"; #[cfg(windows)] @@ -145,7 +141,7 @@ pub(crate) fn analyze_gdb( let fallback_gdb = || { if is_android_gdb_target(target) { - let mut gdb_path = android_cross_path.to_string(); + let mut gdb_path = android_cross_path.unwrap().to_string(); gdb_path.push_str("/bin/gdb"); gdb_path } else { @@ -159,6 +155,10 @@ pub(crate) fn analyze_gdb( Some(ref s) => s.to_owned(), }; + Some(gdb) +} + +pub(crate) fn query_gdb_version(gdb: &str) -> Option { let mut version_line = None; if let Ok(output) = Command::new(&gdb).arg("--version").output() { if let Some(first_line) = String::from_utf8_lossy(&output.stdout).lines().next() { @@ -168,10 +168,10 @@ pub(crate) fn analyze_gdb( let version = match version_line { Some(line) => extract_gdb_version(&line), - None => return (None, None), + None => return None, }; - (Some(gdb), version) + version } pub(crate) fn extract_gdb_version(full_version_line: &str) -> Option { diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index b524017e4dadd..8e0c2693329df 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -256,12 +256,14 @@ fn parse_config(args: Vec) -> Config { } let target = opt_str2(matches.opt_str("target")); - let android_cross_path = opt_path(matches, "android-cross-path"); + let android_cross_path = matches.opt_str("android-cross-path").map(Utf8PathBuf::from); // FIXME: `cdb_version` is *derived* from cdb, but it's *not* technically a config! - let (cdb, cdb_version) = debuggers::analyze_cdb(matches.opt_str("cdb"), &target); + let cdb = debuggers::discover_cdb(matches.opt_str("cdb"), &target); + let cdb_version = cdb.as_deref().and_then(debuggers::query_cdb_version); // FIXME: `gdb_version` is *derived* from gdb, but it's *not* technically a config! - let (gdb, gdb_version) = - debuggers::analyze_gdb(matches.opt_str("gdb"), &target, &android_cross_path); + let gdb = + debuggers::discover_gdb(matches.opt_str("gdb"), &target, android_cross_path.as_deref()); + let gdb_version = gdb.as_deref().and_then(debuggers::query_gdb_version); // FIXME: `lldb_version` is *derived* from lldb, but it's *not* technically a config! let lldb_version = matches.opt_str("lldb-version").as_deref().and_then(debuggers::extract_lldb_version); diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index b82a533271c17..611380a35ae7c 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -18,7 +18,6 @@ use crate::common::{ CompareMode, Config, Debugger, FailMode, PassMode, RunFailMode, RunResult, TestMode, TestPaths, TestSuite, UI_EXTENSIONS, UI_FIXED, UI_RUN_STDERR, UI_RUN_STDOUT, UI_STDERR, UI_STDOUT, UI_SVG, UI_WINDOWS_SVG, expected_output_path, incremental_dir, output_base_dir, output_base_name, - output_testname_unique, }; use crate::directives::TestProps; use crate::errors::{Error, ErrorKind, load_errors}; @@ -563,7 +562,7 @@ impl<'test> TestCx<'test> { self.maybe_add_external_args(&mut rustc, &self.config.target_rustcflags); rustc.args(&self.props.compile_flags); - self.compose_and_run_compiler(rustc, Some(src), self.testpaths) + self.compose_and_run_compiler(rustc, Some(src)) } fn maybe_add_external_args(&self, cmd: &mut Command, args: &Vec) { @@ -994,37 +993,41 @@ impl<'test> TestCx<'test> { passes, ); - self.compose_and_run_compiler(rustc, None, self.testpaths) + self.compose_and_run_compiler(rustc, None) } /// `root_out_dir` and `root_testpaths` refer to the parameters of the actual test being run. /// Auxiliaries, no matter how deep, have the same root_out_dir and root_testpaths. - fn document( + fn document(&self, root_out_dir: &Utf8Path, kind: DocKind) -> ProcRes { + self.document_inner(&self.testpaths.file, root_out_dir, kind) + } + + /// Like `document`, but takes an explicit `file_to_doc` argument so that + /// it can also be used for documenting auxiliaries, in addition to + /// documenting the main test file. + fn document_inner( &self, + file_to_doc: &Utf8Path, root_out_dir: &Utf8Path, - root_testpaths: &TestPaths, kind: DocKind, ) -> ProcRes { if self.props.build_aux_docs { assert_eq!(kind, DocKind::Html, "build-aux-docs only make sense for html output"); for rel_ab in &self.props.aux.builds { - let aux_testpaths = self.compute_aux_test_paths(root_testpaths, rel_ab); - let props_for_aux = - self.props.from_aux_file(&aux_testpaths.file, self.revision, self.config); + let aux_path = self.resolve_aux_path(rel_ab); + let props_for_aux = self.props.from_aux_file(&aux_path, self.revision, self.config); let aux_cx = TestCx { config: self.config, stdout: self.stdout, stderr: self.stderr, props: &props_for_aux, - testpaths: &aux_testpaths, + testpaths: self.testpaths, revision: self.revision, }; // Create the directory for the stdout/stderr files. create_dir_all(aux_cx.output_base_dir()).unwrap(); - // use root_testpaths here, because aux-builds should have the - // same --out-dir and auxiliary directory. - let auxres = aux_cx.document(&root_out_dir, root_testpaths, kind); + let auxres = aux_cx.document_inner(&aux_path, &root_out_dir, kind); if !auxres.status.success() { return auxres; } @@ -1038,7 +1041,7 @@ impl<'test> TestCx<'test> { // actual --out-dir given to the auxiliary or test, as opposed to the root out dir for the entire // test let out_dir: Cow<'_, Utf8Path> = if self.props.unique_doc_out_dir { - let file_name = self.testpaths.file.file_stem().expect("file name should not be empty"); + let file_name = file_to_doc.file_stem().expect("file name should not be empty"); let out_dir = Utf8PathBuf::from_iter([ root_out_dir, Utf8Path::new("docs"), @@ -1052,7 +1055,7 @@ impl<'test> TestCx<'test> { }; let mut rustdoc = Command::new(rustdoc_path); - let current_dir = output_base_dir(self.config, root_testpaths, self.safe_revision()); + let current_dir = self.output_base_dir(); rustdoc.current_dir(current_dir); rustdoc .arg("-L") @@ -1063,7 +1066,7 @@ impl<'test> TestCx<'test> { .arg(out_dir.as_ref()) .arg("--deny") .arg("warnings") - .arg(&self.testpaths.file) + .arg(file_to_doc) .arg("-A") .arg("internal_features") .args(&self.props.compile_flags) @@ -1080,7 +1083,7 @@ impl<'test> TestCx<'test> { rustdoc.arg(format!("-Clinker={}", linker)); } - self.compose_and_run_compiler(rustdoc, None, root_testpaths) + self.compose_and_run_compiler(rustdoc, None) } fn exec_compiled_test(&self) -> ProcRes { @@ -1195,24 +1198,21 @@ impl<'test> TestCx<'test> { /// For each `aux-build: foo/bar` annotation, we check to find the file in an `auxiliary` /// directory relative to the test itself (not any intermediate auxiliaries). - fn compute_aux_test_paths(&self, of: &TestPaths, rel_ab: &str) -> TestPaths { - let test_ab = - of.file.parent().expect("test file path has no parent").join("auxiliary").join(rel_ab); - if !test_ab.exists() { - self.fatal(&format!("aux-build `{}` source not found", test_ab)) + fn resolve_aux_path(&self, relative_aux_path: &str) -> Utf8PathBuf { + let aux_path = self + .testpaths + .file + .parent() + .expect("test file path has no parent") + .join("auxiliary") + .join(relative_aux_path); + if !aux_path.exists() { + self.fatal(&format!( + "auxiliary source file `{relative_aux_path}` not found at `{aux_path}`" + )); } - TestPaths { - file: test_ab, - relative_dir: of - .relative_dir - .join(self.output_testname_unique()) - .join("auxiliary") - .join(rel_ab) - .parent() - .expect("aux-build path has no parent") - .to_path_buf(), - } + aux_path } fn is_vxworks_pure_static(&self) -> bool { @@ -1258,13 +1258,13 @@ impl<'test> TestCx<'test> { aux_dir } - fn build_all_auxiliary(&self, of: &TestPaths, aux_dir: &Utf8Path, rustc: &mut Command) { + fn build_all_auxiliary(&self, aux_dir: &Utf8Path, rustc: &mut Command) { for rel_ab in &self.props.aux.builds { - self.build_auxiliary(of, rel_ab, &aux_dir, None); + self.build_auxiliary(rel_ab, &aux_dir, None); } for rel_ab in &self.props.aux.bins { - self.build_auxiliary(of, rel_ab, &aux_dir, Some(AuxType::Bin)); + self.build_auxiliary(rel_ab, &aux_dir, Some(AuxType::Bin)); } let path_to_crate_name = |path: &str| -> String { @@ -1283,12 +1283,12 @@ impl<'test> TestCx<'test> { }; for (aux_name, aux_path) in &self.props.aux.crates { - let aux_type = self.build_auxiliary(of, &aux_path, &aux_dir, None); + let aux_type = self.build_auxiliary(&aux_path, &aux_dir, None); add_extern(rustc, aux_name, aux_path, aux_type); } for proc_macro in &self.props.aux.proc_macros { - self.build_auxiliary(of, proc_macro, &aux_dir, Some(AuxType::ProcMacro)); + self.build_auxiliary(proc_macro, &aux_dir, Some(AuxType::ProcMacro)); let crate_name = path_to_crate_name(proc_macro); add_extern(rustc, &crate_name, proc_macro, AuxType::ProcMacro); } @@ -1296,7 +1296,7 @@ impl<'test> TestCx<'test> { // Build any `//@ aux-codegen-backend`, and pass the resulting library // to `-Zcodegen-backend` when compiling the test file. if let Some(aux_file) = &self.props.aux.codegen_backend { - let aux_type = self.build_auxiliary(of, aux_file, aux_dir, None); + let aux_type = self.build_auxiliary(aux_file, aux_dir, None); if let Some(lib_name) = get_lib_name(aux_file.trim_end_matches(".rs"), aux_type) { let lib_path = aux_dir.join(&lib_name); rustc.arg(format!("-Zcodegen-backend={}", lib_path)); @@ -1306,12 +1306,7 @@ impl<'test> TestCx<'test> { /// `root_testpaths` refers to the path of the original test. the auxiliary and the test with an /// aux-build have the same `root_testpaths`. - fn compose_and_run_compiler( - &self, - mut rustc: Command, - input: Option, - root_testpaths: &TestPaths, - ) -> ProcRes { + fn compose_and_run_compiler(&self, mut rustc: Command, input: Option) -> ProcRes { if self.props.add_core_stubs { let minicore_path = self.build_minicore(); rustc.arg("--extern"); @@ -1319,7 +1314,7 @@ impl<'test> TestCx<'test> { } let aux_dir = self.aux_output_dir(); - self.build_all_auxiliary(root_testpaths, &aux_dir, &mut rustc); + self.build_all_auxiliary(&aux_dir, &mut rustc); rustc.envs(self.props.rustc_env.clone()); self.props.unset_rustc_env.iter().fold(&mut rustc, Command::env_remove); @@ -1364,14 +1359,12 @@ impl<'test> TestCx<'test> { /// If `aux_type` is `None`, then this will determine the aux-type automatically. fn build_auxiliary( &self, - of: &TestPaths, source_path: &str, aux_dir: &Utf8Path, aux_type: Option, ) -> AuxType { - let aux_testpaths = self.compute_aux_test_paths(of, source_path); - let mut aux_props = - self.props.from_aux_file(&aux_testpaths.file, self.revision, self.config); + let aux_path = self.resolve_aux_path(source_path); + let mut aux_props = self.props.from_aux_file(&aux_path, self.revision, self.config); if aux_type == Some(AuxType::ProcMacro) { aux_props.force_host = true; } @@ -1388,21 +1381,20 @@ impl<'test> TestCx<'test> { stdout: self.stdout, stderr: self.stderr, props: &aux_props, - testpaths: &aux_testpaths, + testpaths: self.testpaths, revision: self.revision, }; // Create the directory for the stdout/stderr files. create_dir_all(aux_cx.output_base_dir()).unwrap(); - let input_file = &aux_testpaths.file; let mut aux_rustc = aux_cx.make_compile_args( - input_file, + &aux_path, aux_output, Emit::None, AllowUnused::No, LinkToAux::No, Vec::new(), ); - aux_cx.build_all_auxiliary(of, &aux_dir, &mut aux_rustc); + aux_cx.build_all_auxiliary(&aux_dir, &mut aux_rustc); aux_rustc.envs(aux_props.rustc_env.clone()); for key in &aux_props.unset_rustc_env { @@ -1471,7 +1463,7 @@ impl<'test> TestCx<'test> { ); if !auxres.status.success() { self.fatal_proc_rec( - &format!("auxiliary build of {} failed to compile: ", aux_testpaths.file), + &format!("auxiliary build of {aux_path} failed to compile: "), &auxres, ); } @@ -2033,11 +2025,6 @@ impl<'test> TestCx<'test> { self.aux_output_dir_name().join("bin") } - /// Generates a unique name for the test, such as `testname.revision.mode`. - fn output_testname_unique(&self) -> Utf8PathBuf { - output_testname_unique(self.config, self.testpaths, self.safe_revision()) - } - /// The revision, ignored for incremental compilation since it wants all revisions in /// the same directory. fn safe_revision(&self) -> Option<&str> { @@ -2132,7 +2119,7 @@ impl<'test> TestCx<'test> { Vec::new(), ); - let proc_res = self.compose_and_run_compiler(rustc, None, self.testpaths); + let proc_res = self.compose_and_run_compiler(rustc, None); (proc_res, output_path) } @@ -2210,9 +2197,9 @@ impl<'test> TestCx<'test> { Vec::new(), ); let aux_dir = new_rustdoc.aux_output_dir(); - new_rustdoc.build_all_auxiliary(&new_rustdoc.testpaths, &aux_dir, &mut rustc); + new_rustdoc.build_all_auxiliary(&aux_dir, &mut rustc); - let proc_res = new_rustdoc.document(&compare_dir, &new_rustdoc.testpaths, DocKind::Html); + let proc_res = new_rustdoc.document(&compare_dir, DocKind::Html); if !proc_res.status.success() { writeln!(self.stderr, "failed to run nightly rustdoc"); return; diff --git a/src/tools/compiletest/src/runtest/assembly.rs b/src/tools/compiletest/src/runtest/assembly.rs index 91d4f620f7194..c805b4c7a59e0 100644 --- a/src/tools/compiletest/src/runtest/assembly.rs +++ b/src/tools/compiletest/src/runtest/assembly.rs @@ -43,7 +43,7 @@ impl TestCx<'_> { Vec::new(), ); - let proc_res = self.compose_and_run_compiler(rustc, None, self.testpaths); + let proc_res = self.compose_and_run_compiler(rustc, None); (proc_res, output_path) } } diff --git a/src/tools/compiletest/src/runtest/coverage.rs b/src/tools/compiletest/src/runtest/coverage.rs index d0a0c960b4512..5b94d9567d8fc 100644 --- a/src/tools/compiletest/src/runtest/coverage.rs +++ b/src/tools/compiletest/src/runtest/coverage.rs @@ -197,7 +197,7 @@ impl<'test> TestCx<'test> { rustdoc_cmd.arg(&self.testpaths.file); - let proc_res = self.compose_and_run_compiler(rustdoc_cmd, None, self.testpaths); + let proc_res = self.compose_and_run_compiler(rustdoc_cmd, None); if !proc_res.status.success() { self.fatal_proc_rec("rustdoc --test failed!", &proc_res) } diff --git a/src/tools/compiletest/src/runtest/debuginfo.rs b/src/tools/compiletest/src/runtest/debuginfo.rs index 9175a38ffa5c9..f0d541cd4cb59 100644 --- a/src/tools/compiletest/src/runtest/debuginfo.rs +++ b/src/tools/compiletest/src/runtest/debuginfo.rs @@ -8,7 +8,6 @@ use tracing::debug; use super::debugger::DebuggerCommands; use super::{Debugger, Emit, ProcRes, TestCx, Truncated, WillExecute}; -use crate::common::Config; use crate::debuggers::{extract_gdb_version, is_android_gdb_target}; impl TestCx<'_> { @@ -21,18 +20,6 @@ impl TestCx<'_> { } fn run_debuginfo_cdb_test(&self) { - let config = Config { - target_rustcflags: self.cleanup_debug_info_options(&self.config.target_rustcflags), - host_rustcflags: self.cleanup_debug_info_options(&self.config.host_rustcflags), - ..self.config.clone() - }; - - let test_cx = TestCx { config: &config, ..*self }; - - test_cx.run_debuginfo_cdb_test_no_opt(); - } - - fn run_debuginfo_cdb_test_no_opt(&self) { let exe_file = self.make_exe_name(); // Existing PDB files are update in-place. When changing the debuginfo @@ -118,18 +105,6 @@ impl TestCx<'_> { } fn run_debuginfo_gdb_test(&self) { - let config = Config { - target_rustcflags: self.cleanup_debug_info_options(&self.config.target_rustcflags), - host_rustcflags: self.cleanup_debug_info_options(&self.config.host_rustcflags), - ..self.config.clone() - }; - - let test_cx = TestCx { config: &config, ..*self }; - - test_cx.run_debuginfo_gdb_test_no_opt(); - } - - fn run_debuginfo_gdb_test_no_opt(&self) { let dbg_cmds = DebuggerCommands::parse_from(&self.testpaths.file, "gdb") .unwrap_or_else(|e| self.fatal(&e)); let mut cmds = dbg_cmds.commands.join("\n"); @@ -153,7 +128,10 @@ impl TestCx<'_> { // write debugger script let mut script_str = String::with_capacity(2048); script_str.push_str(&format!("set charset {}\n", Self::charset())); - script_str.push_str(&format!("set sysroot {}\n", &self.config.android_cross_path)); + script_str.push_str(&format!( + "set sysroot {}\n", + self.config.android_cross_path.as_deref().unwrap() + )); script_str.push_str(&format!("file {}\n", exe_file)); script_str.push_str("target remote :5039\n"); script_str.push_str(&format!( @@ -355,18 +333,6 @@ impl TestCx<'_> { self.fatal("Can't run LLDB test because LLDB's python path is not set."); } - let config = Config { - target_rustcflags: self.cleanup_debug_info_options(&self.config.target_rustcflags), - host_rustcflags: self.cleanup_debug_info_options(&self.config.host_rustcflags), - ..self.config.clone() - }; - - let test_cx = TestCx { config: &config, ..*self }; - - test_cx.run_debuginfo_lldb_test_no_opt(); - } - - fn run_debuginfo_lldb_test_no_opt(&self) { // compile test file (it should have 'compile-flags:-g' in the directive) let should_run = self.run_if_enabled(); let compile_result = self.compile_test(should_run, Emit::None); @@ -501,11 +467,4 @@ impl TestCx<'_> { .env("PYTHONPATH", pythonpath), ) } - - fn cleanup_debug_info_options(&self, options: &Vec) -> Vec { - // Remove options that are either unwanted (-O) or may lead to duplicates due to RUSTFLAGS. - let options_to_remove = ["-O".to_owned(), "-g".to_owned(), "--debuginfo".to_owned()]; - - options.iter().filter(|x| !options_to_remove.contains(x)).cloned().collect() - } } diff --git a/src/tools/compiletest/src/runtest/js_doc.rs b/src/tools/compiletest/src/runtest/js_doc.rs index f7c2e6f01180a..53c40515af74f 100644 --- a/src/tools/compiletest/src/runtest/js_doc.rs +++ b/src/tools/compiletest/src/runtest/js_doc.rs @@ -7,7 +7,7 @@ impl TestCx<'_> { if let Some(nodejs) = &self.config.nodejs { let out_dir = self.output_base_dir(); - self.document(&out_dir, &self.testpaths, DocKind::Html); + self.document(&out_dir, DocKind::Html); let file_stem = self.testpaths.file.file_stem().expect("no file stem"); let res = self.run_command_to_procres( diff --git a/src/tools/compiletest/src/runtest/rustdoc.rs b/src/tools/compiletest/src/runtest/rustdoc.rs index 32b1823961bea..a4558de5f1c0c 100644 --- a/src/tools/compiletest/src/runtest/rustdoc.rs +++ b/src/tools/compiletest/src/runtest/rustdoc.rs @@ -11,7 +11,7 @@ impl TestCx<'_> { panic!("failed to remove and recreate output directory `{out_dir}`: {e}") }); - let proc_res = self.document(&out_dir, &self.testpaths, DocKind::Html); + let proc_res = self.document(&out_dir, DocKind::Html); if !proc_res.status.success() { self.fatal_proc_rec("rustdoc failed!", &proc_res); } diff --git a/src/tools/compiletest/src/runtest/rustdoc_json.rs b/src/tools/compiletest/src/runtest/rustdoc_json.rs index dd7ebe9efaeef..6cb0c2a040535 100644 --- a/src/tools/compiletest/src/runtest/rustdoc_json.rs +++ b/src/tools/compiletest/src/runtest/rustdoc_json.rs @@ -13,7 +13,7 @@ impl TestCx<'_> { panic!("failed to remove and recreate output directory `{out_dir}`: {e}") }); - let proc_res = self.document(&out_dir, &self.testpaths, DocKind::Json); + let proc_res = self.document(&out_dir, DocKind::Json); if !proc_res.status.success() { self.fatal_proc_rec("rustdoc failed!", &proc_res); } diff --git a/src/tools/compiletest/src/runtest/ui.rs b/src/tools/compiletest/src/runtest/ui.rs index c0adb6302e9d0..9147471c5bbcb 100644 --- a/src/tools/compiletest/src/runtest/ui.rs +++ b/src/tools/compiletest/src/runtest/ui.rs @@ -253,7 +253,7 @@ impl TestCx<'_> { rustc.arg(crate_name); } - let res = self.compose_and_run_compiler(rustc, None, self.testpaths); + let res = self.compose_and_run_compiler(rustc, None); if !res.status.success() { self.fatal_proc_rec("failed to compile fixed code", &res); } diff --git a/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs b/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs index 427c84679ba1c..c3f4fd63bac70 100644 --- a/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs +++ b/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs @@ -4,8 +4,3 @@ trait X { fn f<'a>(arg : Box = &'a ()>>) {} //~^ ERROR associated type takes 1 lifetime argument but 0 lifetime arguments //~| ERROR associated type takes 0 generic arguments but 1 generic argument -//~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments -//~| ERROR associated type takes 0 generic arguments but 1 generic argument -//~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments -//~| ERROR associated type takes 0 generic arguments but 1 generic argument -//~| ERROR trait `X` is not dyn compatible diff --git a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr index 2c25589a55314..a29cf5bf5ad92 100644 --- a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr +++ b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr @@ -28,87 +28,6 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ -error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/invalid_const_in_lifetime_position.rs:4:26 - | -LL | fn f<'a>(arg : Box = &'a ()>>) {} - | ^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/invalid_const_in_lifetime_position.rs:2:10 - | -LL | type Y<'a>; - | ^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | fn f<'a>(arg : Box = &'a ()>>) {} - | +++ - -error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/invalid_const_in_lifetime_position.rs:4:26 - | -LL | fn f<'a>(arg : Box = &'a ()>>) {} - | ^--- help: remove the unnecessary generics - | | - | expected 0 generic arguments - | -note: associated type defined here, with 0 generic parameters - --> $DIR/invalid_const_in_lifetime_position.rs:2:10 - | -LL | type Y<'a>; - | ^ - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/invalid_const_in_lifetime_position.rs:4:26 - | -LL | fn f<'a>(arg : Box = &'a ()>>) {} - | ^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/invalid_const_in_lifetime_position.rs:2:10 - | -LL | type Y<'a>; - | ^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | fn f<'a>(arg : Box = &'a ()>>) {} - | +++ - -error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/invalid_const_in_lifetime_position.rs:4:26 - | -LL | fn f<'a>(arg : Box = &'a ()>>) {} - | ^--- help: remove the unnecessary generics - | | - | expected 0 generic arguments - | -note: associated type defined here, with 0 generic parameters - --> $DIR/invalid_const_in_lifetime_position.rs:2:10 - | -LL | type Y<'a>; - | ^ - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0038]: the trait `X` is not dyn compatible - --> $DIR/invalid_const_in_lifetime_position.rs:4:20 - | -LL | fn f<'a>(arg : Box = &'a ()>>) {} - | ^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit - --> $DIR/invalid_const_in_lifetime_position.rs:2:10 - | -LL | trait X { - | - this trait is not dyn compatible... -LL | type Y<'a>; - | ^ ...because it contains the generic associated type `Y` - = help: consider moving `Y` to another trait - -error: aborting due to 7 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0038, E0107. -For more information about an error, try `rustc --explain E0038`. +For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr index 317af7975aa7e..8197cfcba5025 100644 --- a/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr +++ b/tests/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr @@ -30,7 +30,7 @@ note: ...which requires elaborating drops for ` bool { + cfg!(this_is_aux) +} diff --git a/tests/ui/const-generics/generic_const_exprs/issue-102768.rs b/tests/ui/const-generics/generic_const_exprs/issue-102768.rs index 882b27a418e55..18a9b53cf7681 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-102768.rs +++ b/tests/ui/const-generics/generic_const_exprs/issue-102768.rs @@ -9,11 +9,6 @@ const _: () = { fn f2<'a>(arg: Box = &'a ()>>) {} //~^ ERROR associated type takes 1 lifetime argument but 0 lifetime arguments //~| ERROR associated type takes 0 generic arguments but 1 generic argument - //~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments - //~| ERROR associated type takes 0 generic arguments but 1 generic argument - //~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments - //~| ERROR associated type takes 0 generic arguments but 1 generic argument - //~| ERROR `X` is not dyn compatible }; fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr b/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr index 57b61006631f9..8e972100173f8 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr @@ -28,87 +28,6 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ -error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/issue-102768.rs:9:30 - | -LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | ^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-102768.rs:5:10 - | -LL | type Y<'a>; - | ^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | +++ - -error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/issue-102768.rs:9:30 - | -LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | ^--- help: remove the unnecessary generics - | | - | expected 0 generic arguments - | -note: associated type defined here, with 0 generic parameters - --> $DIR/issue-102768.rs:5:10 - | -LL | type Y<'a>; - | ^ - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/issue-102768.rs:9:30 - | -LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | ^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-102768.rs:5:10 - | -LL | type Y<'a>; - | ^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | +++ - -error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/issue-102768.rs:9:30 - | -LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | ^--- help: remove the unnecessary generics - | | - | expected 0 generic arguments - | -note: associated type defined here, with 0 generic parameters - --> $DIR/issue-102768.rs:5:10 - | -LL | type Y<'a>; - | ^ - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0038]: the trait `X` is not dyn compatible - --> $DIR/issue-102768.rs:9:24 - | -LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | ^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit - --> $DIR/issue-102768.rs:5:10 - | -LL | trait X { - | - this trait is not dyn compatible... -LL | type Y<'a>; - | ^ ...because it contains the generic associated type `Y` - = help: consider moving `Y` to another trait - -error: aborting due to 7 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0038, E0107. -For more information about an error, try `rustc --explain E0038`. +For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/consts/const-eval/const-eval-query-stack.stderr b/tests/ui/consts/const-eval/const-eval-query-stack.stderr index 96206dc5078bc..89f9c1e36920d 100644 --- a/tests/ui/consts/const-eval/const-eval-query-stack.stderr +++ b/tests/ui/consts/const-eval/const-eval-query-stack.stderr @@ -10,5 +10,5 @@ note: please make sure that you have updated to the latest nightly query stack during panic: #0 [eval_to_allocation_raw] const-evaluating + checking `X` #1 [eval_to_const_value_raw] simplifying constant for the type system `X` -#2 [analysis] running analysis passes on this crate +#2 [analysis] running analysis passes on crate `const_eval_query_stack` end of query stack diff --git a/tests/ui/consts/recursive-zst-static.default.stderr b/tests/ui/consts/recursive-zst-static.default.stderr index c814576dfd5b9..589ff44ccff1f 100644 --- a/tests/ui/consts/recursive-zst-static.default.stderr +++ b/tests/ui/consts/recursive-zst-static.default.stderr @@ -16,7 +16,7 @@ note: ...which requires evaluating initializer of static `B`... LL | static B: () = A; | ^^^^^^^^^^^^ = note: ...which again requires evaluating initializer of static `A`, completing the cycle - = note: cycle used when running analysis passes on this crate + = note: cycle used when running analysis passes on crate `recursive_zst_static` = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to 2 previous errors diff --git a/tests/ui/consts/recursive-zst-static.unleash.stderr b/tests/ui/consts/recursive-zst-static.unleash.stderr index c814576dfd5b9..589ff44ccff1f 100644 --- a/tests/ui/consts/recursive-zst-static.unleash.stderr +++ b/tests/ui/consts/recursive-zst-static.unleash.stderr @@ -16,7 +16,7 @@ note: ...which requires evaluating initializer of static `B`... LL | static B: () = A; | ^^^^^^^^^^^^ = note: ...which again requires evaluating initializer of static `A`, completing the cycle - = note: cycle used when running analysis passes on this crate + = note: cycle used when running analysis passes on crate `recursive_zst_static` = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to 2 previous errors diff --git a/tests/ui/explicit-tail-calls/become-cast-return.rs b/tests/ui/explicit-tail-calls/become-cast-return.rs new file mode 100644 index 0000000000000..212a0ddcbca15 --- /dev/null +++ b/tests/ui/explicit-tail-calls/become-cast-return.rs @@ -0,0 +1,20 @@ +//@ run-pass +//@ ignore-backends: gcc +#![expect(incomplete_features)] +#![feature(explicit_tail_calls)] + +#[inline(never)] +fn leaf(_: &Box) -> [u8; 1] { + [1] +} + +#[inline(never)] +fn dispatch(param: &Box) -> [u8; 1] { + become leaf(param) +} + +fn main() { + let data = Box::new(0); + let out = dispatch(&data); + assert_eq!(out, [1]); +} diff --git a/tests/ui/explicit-tail-calls/become-indirect-return.rs b/tests/ui/explicit-tail-calls/become-indirect-return.rs new file mode 100644 index 0000000000000..7eec34f3b95c9 --- /dev/null +++ b/tests/ui/explicit-tail-calls/become-indirect-return.rs @@ -0,0 +1,20 @@ +//@ run-pass +//@ ignore-backends: gcc +#![expect(incomplete_features)] +#![feature(explicit_tail_calls)] + +#[inline(never)] +fn op_dummy(_param: &Box) -> [u8; 24] { + [1; 24] +} + +#[inline(never)] +fn dispatch(param: &Box) -> [u8; 24] { + become op_dummy(param) +} + +fn main() { + let param = Box::new(0); + let result = dispatch(¶m); + assert_eq!(result, [1; 24]); +} diff --git a/tests/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.rs b/tests/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.rs index b02739a7d0acb..86b164ba7d8a8 100644 --- a/tests/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.rs +++ b/tests/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.rs @@ -6,7 +6,4 @@ fn main() { fn _f(arg : Box X = &'a [u32]>>) {} //~^ ERROR: use of undeclared lifetime name `'x` //~| ERROR: binding for associated type `Y` references lifetime - //~| ERROR: binding for associated type `Y` references lifetime - //~| ERROR: binding for associated type `Y` references lifetime - //~| ERROR: the trait `X` is not dyn compatible } diff --git a/tests/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr b/tests/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr index c9b46de5c33c4..b77f10084c928 100644 --- a/tests/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr +++ b/tests/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr @@ -20,39 +20,7 @@ error[E0582]: binding for associated type `Y` references lifetime `'a`, which do LL | fn _f(arg : Box X = &'a [u32]>>) {} | ^^^^^^^^^^^^^^^^^ -error[E0582]: binding for associated type `Y` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/gat-in-trait-path-undeclared-lifetime.rs:6:33 - | -LL | fn _f(arg : Box X = &'a [u32]>>) {} - | ^^^^^^^^^^^^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0582]: binding for associated type `Y` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/gat-in-trait-path-undeclared-lifetime.rs:6:33 - | -LL | fn _f(arg : Box X = &'a [u32]>>) {} - | ^^^^^^^^^^^^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0038]: the trait `X` is not dyn compatible - --> $DIR/gat-in-trait-path-undeclared-lifetime.rs:6:19 - | -LL | fn _f(arg : Box X = &'a [u32]>>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit - --> $DIR/gat-in-trait-path-undeclared-lifetime.rs:2:8 - | -LL | trait X { - | - this trait is not dyn compatible... -LL | type Y<'x>; - | ^ ...because it contains the generic associated type `Y` - = help: consider moving `Y` to another trait - -error: aborting due to 5 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0038, E0261, E0582. -For more information about an error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0261, E0582. +For more information about an error, try `rustc --explain E0261`. diff --git a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs index 294fb6743fbcd..22f4918fb1919 100644 --- a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs +++ b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs @@ -7,19 +7,10 @@ fn foo<'a>(arg: Box>) {} //~| ERROR: parenthesized generic arguments cannot be used //~| ERROR associated type takes 0 generic arguments but 1 generic argument //~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments - //~| ERROR associated type takes 0 generic arguments but 1 generic argument - //~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments - //~| ERROR associated type takes 0 generic arguments but 1 generic argument - //~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments - //~| ERROR at least one trait is required - //~| ERROR: the trait `X` is not dyn compatible fn bar<'a>(arg: Box>) {} //~^ ERROR: parenthesized generic arguments cannot be used //~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments - //~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments - //~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments - //~| ERROR: the trait `X` is not dyn compatible fn main() {} diff --git a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr index e18d8198c9455..23199fae28b59 100644 --- a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr +++ b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr @@ -22,7 +22,7 @@ LL + fn foo<'a>(arg: Box = &'a ()>>) {} | error: parenthesized generic arguments cannot be used in associated type constraints - --> $DIR/gat-trait-path-parenthesised-args.rs:18:27 + --> $DIR/gat-trait-path-parenthesised-args.rs:12:27 | LL | fn bar<'a>(arg: Box>) {} | ^-- @@ -60,109 +60,7 @@ LL | type Y<'a>; | ^ error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 - | -LL | fn foo<'a>(arg: Box>) {} - | ^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 - | -LL | type Y<'a>; - | ^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | fn foo<'a>(arg: Box>) {} - | +++ - -error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 - | -LL | fn foo<'a>(arg: Box>) {} - | ^---- help: remove the unnecessary generics - | | - | expected 0 generic arguments - | -note: associated type defined here, with 0 generic parameters - --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 - | -LL | type Y<'a>; - | ^ - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 - | -LL | fn foo<'a>(arg: Box>) {} - | ^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 - | -LL | type Y<'a>; - | ^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | fn foo<'a>(arg: Box>) {} - | +++ - -error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 - | -LL | fn foo<'a>(arg: Box>) {} - | ^---- help: remove the unnecessary generics - | | - | expected 0 generic arguments - | -note: associated type defined here, with 0 generic parameters - --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 - | -LL | type Y<'a>; - | ^ - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0224]: at least one trait is required for an object type - --> $DIR/gat-trait-path-parenthesised-args.rs:5:29 - | -LL | fn foo<'a>(arg: Box>) {} - | ^^ - -error[E0038]: the trait `X` is not dyn compatible - --> $DIR/gat-trait-path-parenthesised-args.rs:5:21 - | -LL | fn foo<'a>(arg: Box>) {} - | ^^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit - --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 - | -LL | trait X { - | - this trait is not dyn compatible... -LL | type Y<'a>; - | ^ ...because it contains the generic associated type `Y` - = help: consider moving `Y` to another trait - -error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/gat-trait-path-parenthesised-args.rs:18:27 - | -LL | fn bar<'a>(arg: Box>) {} - | ^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 - | -LL | type Y<'a>; - | ^ -- -help: add missing lifetime argument - | -LL | fn bar<'a>(arg: Box>) {} - | ++ - -error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/gat-trait-path-parenthesised-args.rs:18:27 + --> $DIR/gat-trait-path-parenthesised-args.rs:12:27 | LL | fn bar<'a>(arg: Box>) {} | ^ expected 1 lifetime argument @@ -172,46 +70,11 @@ note: associated type defined here, with 1 lifetime parameter: `'a` | LL | type Y<'a>; | ^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: add missing lifetime argument | LL | fn bar<'a>(arg: Box>) {} | ++ -error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/gat-trait-path-parenthesised-args.rs:18:27 - | -LL | fn bar<'a>(arg: Box>) {} - | ^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 - | -LL | type Y<'a>; - | ^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | fn bar<'a>(arg: Box>) {} - | ++ - -error[E0038]: the trait `X` is not dyn compatible - --> $DIR/gat-trait-path-parenthesised-args.rs:18:21 - | -LL | fn bar<'a>(arg: Box>) {} - | ^^^^^^^^^^^^^^^ `X` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit - --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 - | -LL | trait X { - | - this trait is not dyn compatible... -LL | type Y<'a>; - | ^ ...because it contains the generic associated type `Y` - = help: consider moving `Y` to another trait - -error: aborting due to 15 previous errors +error: aborting due to 6 previous errors -Some errors have detailed explanations: E0038, E0107, E0224. -For more information about an error, try `rustc --explain E0038`. +For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/generic-associated-types/issue-67510.rs b/tests/ui/generic-associated-types/issue-67510.rs index 5c3150a77ed1b..2db9fb82aaec4 100644 --- a/tests/ui/generic-associated-types/issue-67510.rs +++ b/tests/ui/generic-associated-types/issue-67510.rs @@ -5,6 +5,5 @@ trait X { fn f(x: Box = &'a ()>>) {} //~^ ERROR: use of undeclared lifetime name `'a` //~| ERROR: use of undeclared lifetime name `'a` -//~| ERROR: the trait `X` is not dyn compatible [E0038] fn main() {} diff --git a/tests/ui/generic-associated-types/issue-67510.stderr b/tests/ui/generic-associated-types/issue-67510.stderr index f5c494788ea58..34d867621d7e0 100644 --- a/tests/ui/generic-associated-types/issue-67510.stderr +++ b/tests/ui/generic-associated-types/issue-67510.stderr @@ -29,23 +29,6 @@ help: consider introducing lifetime `'a` here LL | fn f<'a>(x: Box = &'a ()>>) {} | ++++ -error[E0038]: the trait `X` is not dyn compatible - --> $DIR/issue-67510.rs:5:13 - | -LL | fn f(x: Box = &'a ()>>) {} - | ^^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit - --> $DIR/issue-67510.rs:2:10 - | -LL | trait X { - | - this trait is not dyn compatible... -LL | type Y<'a>; - | ^ ...because it contains the generic associated type `Y` - = help: consider moving `Y` to another trait - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0038, E0261. -For more information about an error, try `rustc --explain E0038`. +For more information about this error, try `rustc --explain E0261`. diff --git a/tests/ui/generic-associated-types/issue-71176.rs b/tests/ui/generic-associated-types/issue-71176.rs index 8ecfa93750d48..f0e162d825f9d 100644 --- a/tests/ui/generic-associated-types/issue-71176.rs +++ b/tests/ui/generic-associated-types/issue-71176.rs @@ -9,14 +9,10 @@ impl Provider for () { struct Holder { inner: Box>, //~^ ERROR: missing generics for associated type - //~| ERROR: missing generics for associated type - //~| ERROR: missing generics for associated type - //~| ERROR: the trait `Provider` is not dyn compatible } fn main() { Holder { inner: Box::new(()), - //~^ ERROR: the trait `Provider` is not dyn compatible }; } diff --git a/tests/ui/generic-associated-types/issue-71176.stderr b/tests/ui/generic-associated-types/issue-71176.stderr index f231056a2eed8..ed837f3475338 100644 --- a/tests/ui/generic-associated-types/issue-71176.stderr +++ b/tests/ui/generic-associated-types/issue-71176.stderr @@ -14,75 +14,6 @@ help: add missing lifetime argument LL | inner: Box = B>>, | ++++ -error[E0107]: missing generics for associated type `Provider::A` - --> $DIR/issue-71176.rs:10:27 - | -LL | inner: Box>, - | ^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-71176.rs:2:10 - | -LL | type A<'a>; - | ^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | inner: Box = B>>, - | ++++ - -error[E0107]: missing generics for associated type `Provider::A` - --> $DIR/issue-71176.rs:10:27 - | -LL | inner: Box>, - | ^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-71176.rs:2:10 - | -LL | type A<'a>; - | ^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | inner: Box = B>>, - | ++++ - -error[E0038]: the trait `Provider` is not dyn compatible - --> $DIR/issue-71176.rs:10:14 - | -LL | inner: Box>, - | ^^^^^^^^^^^^^^^^^^^ `Provider` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit - --> $DIR/issue-71176.rs:2:10 - | -LL | trait Provider { - | -------- this trait is not dyn compatible... -LL | type A<'a>; - | ^ ...because it contains the generic associated type `A` - = help: consider moving `A` to another trait - = help: only type `()` implements `Provider`; consider using it directly instead. - -error[E0038]: the trait `Provider` is not dyn compatible - --> $DIR/issue-71176.rs:19:16 - | -LL | inner: Box::new(()), - | ^^^^^^^^^^^^ `Provider` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit - --> $DIR/issue-71176.rs:2:10 - | -LL | trait Provider { - | -------- this trait is not dyn compatible... -LL | type A<'a>; - | ^ ...because it contains the generic associated type `A` - = help: consider moving `A` to another trait - = help: only type `()` implements `Provider`; consider using it directly instead. - -error: aborting due to 5 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0038, E0107. -For more information about an error, try `rustc --explain E0038`. +For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/generic-associated-types/missing_lifetime_args.rs b/tests/ui/generic-associated-types/missing_lifetime_args.rs index e0f2db5eb21ed..331511ba61a48 100644 --- a/tests/ui/generic-associated-types/missing_lifetime_args.rs +++ b/tests/ui/generic-associated-types/missing_lifetime_args.rs @@ -10,9 +10,6 @@ struct Foo<'a, 'b, 'c> { fn foo<'c, 'd>(_arg: Box>) {} //~^ ERROR missing generics for associated type -//~| ERROR missing generics for associated type -//~| ERROR missing generics for associated type -//~| ERROR the trait `X` is not dyn compatible fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {} //~^ ERROR struct takes 3 lifetime arguments but 2 lifetime diff --git a/tests/ui/generic-associated-types/missing_lifetime_args.stderr b/tests/ui/generic-associated-types/missing_lifetime_args.stderr index 7b6888817f4f4..1a7a2e787a1a9 100644 --- a/tests/ui/generic-associated-types/missing_lifetime_args.stderr +++ b/tests/ui/generic-associated-types/missing_lifetime_args.stderr @@ -14,58 +14,8 @@ help: add missing lifetime arguments LL | fn foo<'c, 'd>(_arg: Box = (&'c u32, &'d u32)>>) {} | ++++++++ -error[E0107]: missing generics for associated type `X::Y` - --> $DIR/missing_lifetime_args.rs:11:32 - | -LL | fn foo<'c, 'd>(_arg: Box>) {} - | ^ expected 2 lifetime arguments - | -note: associated type defined here, with 2 lifetime parameters: `'a`, `'b` - --> $DIR/missing_lifetime_args.rs:2:10 - | -LL | type Y<'a, 'b>; - | ^ -- -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime arguments - | -LL | fn foo<'c, 'd>(_arg: Box = (&'c u32, &'d u32)>>) {} - | ++++++++ - -error[E0107]: missing generics for associated type `X::Y` - --> $DIR/missing_lifetime_args.rs:11:32 - | -LL | fn foo<'c, 'd>(_arg: Box>) {} - | ^ expected 2 lifetime arguments - | -note: associated type defined here, with 2 lifetime parameters: `'a`, `'b` - --> $DIR/missing_lifetime_args.rs:2:10 - | -LL | type Y<'a, 'b>; - | ^ -- -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime arguments - | -LL | fn foo<'c, 'd>(_arg: Box = (&'c u32, &'d u32)>>) {} - | ++++++++ - -error[E0038]: the trait `X` is not dyn compatible - --> $DIR/missing_lifetime_args.rs:11:26 - | -LL | fn foo<'c, 'd>(_arg: Box>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit - --> $DIR/missing_lifetime_args.rs:2:10 - | -LL | trait X { - | - this trait is not dyn compatible... -LL | type Y<'a, 'b>; - | ^ ...because it contains the generic associated type `Y` - = help: consider moving `Y` to another trait - error[E0107]: struct takes 3 lifetime arguments but 2 lifetime arguments were supplied - --> $DIR/missing_lifetime_args.rs:17:26 + --> $DIR/missing_lifetime_args.rs:14:26 | LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {} | ^^^ -- -- supplied 2 lifetime arguments @@ -83,7 +33,7 @@ LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b, 'a>) {} | ++++ error[E0107]: struct takes 3 lifetime arguments but 1 lifetime argument was supplied - --> $DIR/missing_lifetime_args.rs:20:16 + --> $DIR/missing_lifetime_args.rs:17:16 | LL | fn f<'a>(_arg: Foo<'a>) {} | ^^^ -- supplied 1 lifetime argument @@ -100,7 +50,6 @@ help: add missing lifetime arguments LL | fn f<'a>(_arg: Foo<'a, 'a, 'a>) {} | ++++++++ -error: aborting due to 6 previous errors +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0038, E0107. -For more information about an error, try `rustc --explain E0038`. +For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs index c828691bb3058..c58f9cf1dfc8e 100644 --- a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs +++ b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs @@ -6,11 +6,6 @@ const _: () = { fn f2<'a>(arg : Box = &'a ()>>) {} //~^ ERROR associated type takes 1 lifetime argument but 0 lifetime arguments //~| ERROR associated type takes 0 generic arguments but 1 generic argument - //~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments - //~| ERROR associated type takes 0 generic arguments but 1 generic argument - //~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments - //~| ERROR associated type takes 0 generic arguments but 1 generic argument - //~| ERROR the trait `X` is not dyn compatible }; fn main() {} diff --git a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr index 45bca1a76287d..682fa27ab5d65 100644 --- a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr +++ b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr @@ -28,87 +28,6 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ -error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/trait-path-type-error-once-implemented.rs:6:29 - | -LL | fn f2<'a>(arg : Box = &'a ()>>) {} - | ^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/trait-path-type-error-once-implemented.rs:2:10 - | -LL | type Y<'a>; - | ^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | fn f2<'a>(arg : Box = &'a ()>>) {} - | +++ - -error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/trait-path-type-error-once-implemented.rs:6:29 - | -LL | fn f2<'a>(arg : Box = &'a ()>>) {} - | ^--- help: remove the unnecessary generics - | | - | expected 0 generic arguments - | -note: associated type defined here, with 0 generic parameters - --> $DIR/trait-path-type-error-once-implemented.rs:2:10 - | -LL | type Y<'a>; - | ^ - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/trait-path-type-error-once-implemented.rs:6:29 - | -LL | fn f2<'a>(arg : Box = &'a ()>>) {} - | ^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/trait-path-type-error-once-implemented.rs:2:10 - | -LL | type Y<'a>; - | ^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | fn f2<'a>(arg : Box = &'a ()>>) {} - | +++ - -error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/trait-path-type-error-once-implemented.rs:6:29 - | -LL | fn f2<'a>(arg : Box = &'a ()>>) {} - | ^--- help: remove the unnecessary generics - | | - | expected 0 generic arguments - | -note: associated type defined here, with 0 generic parameters - --> $DIR/trait-path-type-error-once-implemented.rs:2:10 - | -LL | type Y<'a>; - | ^ - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0038]: the trait `X` is not dyn compatible - --> $DIR/trait-path-type-error-once-implemented.rs:6:23 - | -LL | fn f2<'a>(arg : Box = &'a ()>>) {} - | ^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit - --> $DIR/trait-path-type-error-once-implemented.rs:2:10 - | -LL | trait X { - | - this trait is not dyn compatible... -LL | type Y<'a>; - | ^ ...because it contains the generic associated type `Y` - = help: consider moving `Y` to another trait - -error: aborting due to 7 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0038, E0107. -For more information about an error, try `rustc --explain E0038`. +For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/layout/issue-84108.rs b/tests/ui/layout/issue-84108.rs index 33884617acbf8..07ff3d3c0e3ee 100644 --- a/tests/ui/layout/issue-84108.rs +++ b/tests/ui/layout/issue-84108.rs @@ -8,8 +8,6 @@ static FOO: (dyn AsRef, u8) = ("hello", 42); const BAR: (&Path, [u8], usize) = ("hello", [], 42); //~^ ERROR cannot find type `Path` in this scope -//~| ERROR the size for values of type `[u8]` cannot be known at compilation time -//~| ERROR the size for values of type `[u8]` cannot be known at compilation time //~| ERROR mismatched types static BAZ: ([u8], usize) = ([], 0); diff --git a/tests/ui/layout/issue-84108.stderr b/tests/ui/layout/issue-84108.stderr index 62a6ae341fa6e..08acc3d3b2579 100644 --- a/tests/ui/layout/issue-84108.stderr +++ b/tests/ui/layout/issue-84108.stderr @@ -21,16 +21,7 @@ LL + use std::path::Path; | error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/issue-84108.rs:9:12 - | -LL | const BAR: (&Path, [u8], usize) = ("hello", [], 42); - | ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `[u8]` - = note: only the last element of a tuple may have a dynamically sized type - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/issue-84108.rs:15:13 + --> $DIR/issue-84108.rs:13:13 | LL | static BAZ: ([u8], usize) = ([], 0); | ^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -38,16 +29,6 @@ LL | static BAZ: ([u8], usize) = ([], 0); = help: the trait `Sized` is not implemented for `[u8]` = note: only the last element of a tuple may have a dynamically sized type -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/issue-84108.rs:9:12 - | -LL | const BAR: (&Path, [u8], usize) = ("hello", [], 42); - | ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `[u8]` - = note: only the last element of a tuple may have a dynamically sized type - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - error[E0308]: mismatched types --> $DIR/issue-84108.rs:9:45 | @@ -57,7 +38,7 @@ LL | const BAR: (&Path, [u8], usize) = ("hello", [], 42); = note: expected slice `[u8]` found array `[_; 0]` -error: aborting due to 6 previous errors +error: aborting due to 4 previous errors Some errors have detailed explanations: E0277, E0308, E0412. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/track-diagnostics/track.stderr b/tests/ui/track-diagnostics/track.stderr index 76b4bd14f5cd6..ba314c14b37ef 100644 --- a/tests/ui/track-diagnostics/track.stderr +++ b/tests/ui/track-diagnostics/track.stderr @@ -41,7 +41,7 @@ note: compiler flags: ... -Z ui-testing ... -Z track-diagnostics query stack during panic: #0 [typeck] type-checking `main` -#1 [analysis] running analysis passes on this crate +#1 [analysis] running analysis passes on crate `track` end of query stack error: aborting due to 3 previous errors diff --git a/tests/ui/traits/next-solver/issue-118950-root-region.rs b/tests/ui/traits/next-solver/issue-118950-root-region.rs index fe336766891da..84e2f4c94386d 100644 --- a/tests/ui/traits/next-solver/issue-118950-root-region.rs +++ b/tests/ui/traits/next-solver/issue-118950-root-region.rs @@ -18,7 +18,5 @@ impl Overlap for T {} impl Overlap fn(Assoc<'a, T>)> for T where Missing: Overlap {} //~^ ERROR cannot find type `Missing` in this scope -//~| ERROR the trait bound `T: Overlap fn(Assoc<'a, T>)>` is not satisfied -//~| ERROR the trait bound `for<'a> *const T: ToUnit<'a>` is not satisfied fn main() {} diff --git a/tests/ui/traits/next-solver/issue-118950-root-region.stderr b/tests/ui/traits/next-solver/issue-118950-root-region.stderr index ce4f742a3fa97..e934c5cdc7494 100644 --- a/tests/ui/traits/next-solver/issue-118950-root-region.stderr +++ b/tests/ui/traits/next-solver/issue-118950-root-region.stderr @@ -26,30 +26,7 @@ LL | trait ToUnit<'a> { | ^^^^^^^^^^^^^^^^ WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a)), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc), .. } -error[E0277]: the trait bound `for<'a> *const T: ToUnit<'a>` is not satisfied - --> $DIR/issue-118950-root-region.rs:19:9 - | -LL | impl Overlap fn(Assoc<'a, T>)> for T where Missing: Overlap {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> ToUnit<'a>` is not implemented for `*const T` - | -help: this trait has no implementations, consider adding one - --> $DIR/issue-118950-root-region.rs:8:1 - | -LL | trait ToUnit<'a> { - | ^^^^^^^^^^^^^^^^ - -error[E0277]: the trait bound `T: Overlap fn(Assoc<'a, T>)>` is not satisfied - --> $DIR/issue-118950-root-region.rs:19:47 - | -LL | impl Overlap fn(Assoc<'a, T>)> for T where Missing: Overlap {} - | ^ the trait `Overlap fn(Assoc<'a, T>)>` is not implemented for `T` - | -help: consider further restricting type parameter `T` with trait `Overlap` - | -LL | impl Overlap fn(Assoc<'a, T>)> for T where Missing: Overlap, T: Overlap fn(Assoc<'a, T>)> {} - | ++++++++++++++++++++++++++++++++++++++ - -error: aborting due to 4 previous errors; 1 warning emitted +error: aborting due to 2 previous errors; 1 warning emitted Some errors have detailed explanations: E0277, E0412. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/issue-101739-1.rs b/tests/ui/transmutability/issue-101739-1.rs index b801e2355404c..afd8aba51ce94 100644 --- a/tests/ui/transmutability/issue-101739-1.rs +++ b/tests/ui/transmutability/issue-101739-1.rs @@ -6,7 +6,6 @@ mod assert { pub fn is_transmutable() where Dst: TransmuteFrom, //~ ERROR cannot find type `Dst` in this scope - //~| ERROR the constant `ASSUME_ALIGNMENT` is not of type `Assume` { } } diff --git a/tests/ui/transmutability/issue-101739-1.stderr b/tests/ui/transmutability/issue-101739-1.stderr index b3c640a00b4c4..20bc8af47f8d9 100644 --- a/tests/ui/transmutability/issue-101739-1.stderr +++ b/tests/ui/transmutability/issue-101739-1.stderr @@ -4,15 +4,6 @@ error[E0412]: cannot find type `Dst` in this scope LL | Dst: TransmuteFrom, | ^^^ not found in this scope -error: the constant `ASSUME_ALIGNMENT` is not of type `Assume` - --> $DIR/issue-101739-1.rs:8:14 - | -LL | Dst: TransmuteFrom, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Assume`, found `bool` - | -note: required by a const generic parameter in `TransmuteFrom` - --> $SRC_DIR/core/src/mem/transmutability.rs:LL:COL - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/treat-err-as-bug/err.stderr b/tests/ui/treat-err-as-bug/err.stderr index 0052dd7562654..2a9935c5d22bd 100644 --- a/tests/ui/treat-err-as-bug/err.stderr +++ b/tests/ui/treat-err-as-bug/err.stderr @@ -9,5 +9,5 @@ error: the compiler unexpectedly panicked. this is a bug. query stack during panic: #0 [eval_static_initializer] evaluating initializer of static `C` -#1 [analysis] running analysis passes on this crate +#1 [analysis] running analysis passes on crate `err` end of query stack