From 940bf0115d99ec8b49f06d280b24c0afab1a27a8 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 3 Sep 2025 20:23:12 -0500 Subject: [PATCH 1/3] refactor(cli): Manually inline _display_error --- src/cargo/lib.rs | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index cee6ce4dec2..276c81d784b 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -182,7 +182,17 @@ pub fn exit_with_error(err: CliError, shell: &mut Shell) -> ! { /// Displays an error, and all its causes, to stderr. pub fn display_error(err: &Error, shell: &mut Shell) { debug!("display_error; err={:?}", err); - _display_error(err, shell, true); + + let mut errs = error_chain(err, shell.verbosity()); + let Some(first) = errs.next() else { + return; + }; + drop(shell.error(&first)); + for err in errs { + drop(writeln!(shell.err(), "\nCaused by:")); + drop(write!(shell.err(), "{}", indented_lines(&err.to_string()))); + } + if err .chain() .any(|e| e.downcast_ref::().is_some()) @@ -204,7 +214,16 @@ pub fn display_error(err: &Error, shell: &mut Shell) { pub fn display_warning_with_error(warning: &str, err: &Error, shell: &mut Shell) { drop(shell.warn(warning)); drop(writeln!(shell.err())); - _display_error(err, shell, false); + + let mut errs = error_chain(err, shell.verbosity()); + let Some(first) = errs.next() else { + return; + }; + drop(writeln!(shell.err(), "{first}")); + for err in errs { + drop(writeln!(shell.err(), "\nCaused by:")); + drop(write!(shell.err(), "{}", indented_lines(&err.to_string()))); + } } fn error_chain(err: &Error, verbosity: Verbosity) -> impl Iterator { @@ -219,18 +238,3 @@ fn error_chain(err: &Error, verbosity: Verbosity) -> impl Iterator()) .map(|err| err as &dyn std::fmt::Display) } - -fn _display_error(err: &Error, shell: &mut Shell, as_err: bool) { - for (i, err) in error_chain(err, shell.verbosity()).enumerate() { - if i == 0 { - if as_err { - drop(shell.error(&err)); - } else { - drop(writeln!(shell.err(), "{}", err)); - } - } else { - drop(writeln!(shell.err(), "\nCaused by:")); - drop(write!(shell.err(), "{}", indented_lines(&err.to_string()))); - } - } -} From 2fd5892337817a8387c242d31c751738c17c4f35 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 3 Sep 2025 20:35:38 -0500 Subject: [PATCH 2/3] fix(cli): Use Shell::print_report for warning with errors --- src/cargo/lib.rs | 16 +++++++--------- tests/testsuite/workspaces.rs | 1 - 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index 276c81d784b..2008144d71d 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -212,18 +212,16 @@ pub fn display_error(err: &Error, shell: &mut Shell) { /// Displays a warning, with an error object providing detailed information /// and context. pub fn display_warning_with_error(warning: &str, err: &Error, shell: &mut Shell) { - drop(shell.warn(warning)); - drop(writeln!(shell.err())); + use annotate_snippets::*; - let mut errs = error_chain(err, shell.verbosity()); - let Some(first) = errs.next() else { - return; - }; - drop(writeln!(shell.err(), "{first}")); + let mut group = Group::with_title(Level::WARNING.primary_title(warning)); + + let errs = error_chain(err, shell.verbosity()); for err in errs { - drop(writeln!(shell.err(), "\nCaused by:")); - drop(write!(shell.err(), "{}", indented_lines(&err.to_string()))); + group = group.element(Level::ERROR.with_name("caused by").message(err.to_string())); } + + drop(shell.print_report(&[group], true)); } fn error_chain(err: &Error, verbosity: Verbosity) -> impl Iterator { diff --git a/tests/testsuite/workspaces.rs b/tests/testsuite/workspaces.rs index 0f8ab785baf..9d1f1270fe1 100644 --- a/tests/testsuite/workspaces.rs +++ b/tests/testsuite/workspaces.rs @@ -1120,7 +1120,6 @@ fn new_warning_with_corrupt_ws() { 1 | asdf | ^ [WARNING] compiling this new package may not work due to invalid workspace configuration - [NOTE] see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html "#]]).run(); From 8e84375b2e672975b2277012ab43ef6993dae69b Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 3 Sep 2025 20:35:53 -0500 Subject: [PATCH 3/3] fix(cli): Use Shell::print_report for process-exit errors --- src/cargo/lib.rs | 19 +- tests/testsuite/alt_registry.rs | 45 +- tests/testsuite/artifact_dep.rs | 59 +- tests/testsuite/artifact_dir.rs | 4 +- tests/testsuite/bad_config.rs | 461 ++++++--------- tests/testsuite/bench.rs | 4 +- tests/testsuite/binary_name.rs | 14 +- tests/testsuite/build.rs | 241 ++++---- tests/testsuite/build_dir.rs | 8 +- tests/testsuite/build_script.rs | 188 +++--- tests/testsuite/build_script_env.rs | 12 +- .../testsuite/build_script_extra_link_arg.rs | 6 +- tests/testsuite/build_scripts_multiple.rs | 25 +- .../stderr.term.svg | 4 +- .../cargo_add/add_toolchain/stderr.term.svg | 6 +- .../stderr.term.svg | 4 +- .../deprecated_section/stderr.term.svg | 4 +- .../cargo_add/empty_dep_name/stderr.term.svg | 4 +- .../stderr.term.svg | 12 +- .../feature_suggestion_none/stderr.term.svg | 10 +- .../feature_suggestion_single/stderr.term.svg | 8 +- .../stderr.term.svg | 12 +- .../stderr.term.svg | 12 +- .../features_unknown/stderr.term.svg | 8 +- .../stderr.term.svg | 8 +- .../git_conflicts_namever/stderr.term.svg | 4 +- .../stderr.term.svg | 12 +- .../cargo_add/git_registry/stderr.term.svg | 15 +- .../invalid_git_name/stderr.term.svg | 4 +- .../stderr.term.svg | 4 +- .../stderr.term.svg | 4 +- .../stderr.term.svg | 4 +- .../invalid_name_external/stderr.term.svg | 4 +- .../cargo_add/invalid_path/stderr.term.svg | 27 +- .../invalid_path_name/stderr.term.svg | 4 +- .../invalid_path_self/stderr.term.svg | 4 +- .../cargo_add/invalid_vers/stderr.term.svg | 15 +- .../cargo_add/locked_changed/stderr.term.svg | 4 +- .../missing_at_in_crate_spec/stderr.term.svg | 8 +- .../stderr.term.svg | 4 +- .../stderr.term.svg | 4 +- .../normalize_name_git/stderr.term.svg | 4 +- .../normalize_name_path/stderr.term.svg | 4 +- .../stderr.term.svg | 4 +- .../offline_empty_cache/stderr.term.svg | 4 +- .../stderr.term.svg | 6 +- .../path_base_unstable/stderr.term.svg | 16 +- .../stderr.term.svg | 4 +- .../prefixed_v_in_version/stderr.term.svg | 19 +- .../rust_version_incompatible/stderr.term.svg | 6 +- .../rustc_incompatible/stderr.term.svg | 8 +- .../unknown_inherited_feature/stderr.term.svg | 18 +- tests/testsuite/cargo_alias_config.rs | 41 +- tests/testsuite/cargo_command.rs | 72 +-- tests/testsuite/cargo_config/mod.rs | 2 +- tests/testsuite/cargo_env_config.rs | 9 +- tests/testsuite/cargo_features.rs | 171 +++--- .../cargo_info/not_found/stderr.term.svg | 6 +- .../stderr.term.svg | 15 +- .../stderr.term.svg | 6 +- .../with_frozen_outside_ws/stderr.term.svg | 4 +- .../with_frozen_within_ws/stderr.term.svg | 6 +- .../with_locked_outside_ws/stderr.term.svg | 4 +- .../with_locked_within_ws/stderr.term.svg | 6 +- .../cargo_info/with_offline/stderr.term.svg | 6 +- .../both_lib_and_bin/stderr.term.svg | 4 +- .../stderr.term.svg | 4 +- .../stderr.term.svg | 4 +- .../invalid_dir_name/stderr.term.svg | 20 +- .../stderr.term.svg | 10 +- .../cargo_init/no_filename/stderr.term.svg | 4 +- .../cargo_init/reserved_name/stderr.term.svg | 20 +- .../cargo_new/empty_name/stderr.term.svg | 4 +- .../cargo_remove/invalid_dep/stderr.term.svg | 4 +- .../invalid_package/stderr.term.svg | 6 +- .../invalid_package_multiple/stderr.term.svg | 6 +- .../invalid_section/stderr.term.svg | 4 +- .../invalid_section_dep/stderr.term.svg | 4 +- .../invalid_target/stderr.term.svg | 6 +- .../invalid_target_dep/stderr.term.svg | 6 +- tests/testsuite/cargo_tree/deps.rs | 15 +- .../toolchain_pkgname/stderr.term.svg | 6 +- tests/testsuite/cfg.rs | 67 +-- tests/testsuite/check.rs | 5 +- tests/testsuite/check_cfg.rs | 10 +- tests/testsuite/clean.rs | 12 +- tests/testsuite/compile_time_deps.rs | 4 +- tests/testsuite/credential_process.rs | 30 +- tests/testsuite/direct_minimal_versions.rs | 38 +- tests/testsuite/directory.rs | 82 ++- tests/testsuite/doc.rs | 28 +- tests/testsuite/edition.rs | 28 +- tests/testsuite/feature_unification.rs | 4 +- tests/testsuite/features.rs | 92 ++- tests/testsuite/features2.rs | 12 +- tests/testsuite/features_namespaced.rs | 89 ++- tests/testsuite/fix.rs | 26 +- tests/testsuite/freshness.rs | 8 +- tests/testsuite/freshness_checksum.rs | 10 +- tests/testsuite/future_incompat_report.rs | 2 +- tests/testsuite/git.rs | 113 ++-- tests/testsuite/global_cache_tracker.rs | 4 +- tests/testsuite/help.rs | 10 +- .../testsuite/inheritable_workspace_fields.rs | 60 +- tests/testsuite/install.rs | 83 +-- tests/testsuite/install_upgrade.rs | 2 +- .../testsuite/lints/inherited/stderr.term.svg | 3 +- tests/testsuite/lints_table.rs | 20 +- tests/testsuite/list_availables.rs | 554 +++++++++--------- tests/testsuite/local_registry.rs | 39 +- tests/testsuite/lockfile_compat.rs | 79 ++- tests/testsuite/lockfile_path.rs | 39 +- tests/testsuite/login.rs | 25 +- tests/testsuite/metabuild.rs | 24 +- tests/testsuite/metadata.rs | 5 +- tests/testsuite/new.rs | 93 ++- tests/testsuite/offline.rs | 71 ++- tests/testsuite/open_namespaces.rs | 19 +- tests/testsuite/owner.rs | 10 +- tests/testsuite/package.rs | 223 ++++--- tests/testsuite/package_features.rs | 86 +-- tests/testsuite/package_message_format.rs | 2 +- tests/testsuite/patch.rs | 130 ++-- tests/testsuite/path.rs | 57 +- tests/testsuite/pkgid.rs | 50 +- tests/testsuite/precise_pre_release.rs | 36 +- tests/testsuite/proc_macro.rs | 5 +- tests/testsuite/profile_config.rs | 23 +- tests/testsuite/profile_custom.rs | 5 +- tests/testsuite/profile_overrides.rs | 2 +- tests/testsuite/profile_trim_paths.rs | 12 +- tests/testsuite/profiles.rs | 33 +- tests/testsuite/progress.rs | 5 +- tests/testsuite/pub_priv.rs | 19 +- tests/testsuite/publish.rs | 194 +++--- tests/testsuite/publish_lockfile.rs | 12 +- tests/testsuite/registry.rs | 339 +++++------ tests/testsuite/registry_auth.rs | 119 ++-- tests/testsuite/rename_deps.rs | 5 +- tests/testsuite/replace.rs | 77 ++- tests/testsuite/required_features.rs | 42 +- tests/testsuite/run.rs | 107 ++-- tests/testsuite/rust_version.rs | 21 +- tests/testsuite/rustc.rs | 14 +- tests/testsuite/rustdoc.rs | 8 +- tests/testsuite/rustflags.rs | 204 +++---- tests/testsuite/script/cargo.rs | 103 ++-- tests/testsuite/search.rs | 2 +- tests/testsuite/shell_quoting.rs | 5 +- tests/testsuite/source_replacement.rs | 6 +- tests/testsuite/test.rs | 87 ++- tests/testsuite/tool_paths.rs | 13 +- tests/testsuite/unit_graph.rs | 4 +- tests/testsuite/update.rs | 41 +- tests/testsuite/vendor.rs | 37 +- tests/testsuite/warning_override.rs | 5 +- tests/testsuite/weak_dep_features.rs | 7 +- tests/testsuite/workspaces.rs | 99 ++-- tests/testsuite/yank.rs | 24 +- 159 files changed, 2754 insertions(+), 3176 deletions(-) diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index 2008144d71d..9eae6966613 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -181,32 +181,35 @@ pub fn exit_with_error(err: CliError, shell: &mut Shell) -> ! { /// Displays an error, and all its causes, to stderr. pub fn display_error(err: &Error, shell: &mut Shell) { + use annotate_snippets::*; + debug!("display_error; err={:?}", err); let mut errs = error_chain(err, shell.verbosity()); let Some(first) = errs.next() else { return; }; - drop(shell.error(&first)); + let mut group = Group::with_title(Level::ERROR.primary_title(first.to_string())); for err in errs { - drop(writeln!(shell.err(), "\nCaused by:")); - drop(write!(shell.err(), "{}", indented_lines(&err.to_string()))); + group = group.element(Level::ERROR.with_name("caused by").message(err.to_string())); } if err .chain() .any(|e| e.downcast_ref::().is_some()) { - drop(shell.note("this is an unexpected cargo internal error")); - drop( - shell.note( + group = group.elements([ + Level::NOTE.message("this is an unexpected cargo internal error"), + Level::NOTE.message( "we would appreciate a bug report: https://github.com/rust-lang/cargo/issues/", ), - ); - drop(shell.note(format!("cargo {}", version()))); + Level::NOTE.message(format!("cargo {}", version())), + ]); // Once backtraces are stabilized, this should print out a backtrace // if it is available. } + + drop(shell.print_report(&[group], true)); } /// Displays a warning, with an error object providing detailed information diff --git a/tests/testsuite/alt_registry.rs b/tests/testsuite/alt_registry.rs index 7c49dfa5e07..8342519f66d 100644 --- a/tests/testsuite/alt_registry.rs +++ b/tests/testsuite/alt_registry.rs @@ -252,9 +252,8 @@ fn registry_incompatible_with_git() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - dependency (bar) specification is ambiguous. Only one of `git` or `registry` is allowed. + | + = caused by: dependency (bar) specification is ambiguous. Only one of `git` or `registry` is allowed. "#]]) .run(); @@ -289,11 +288,10 @@ fn cannot_publish_to_crates_io_with_registry_dependency() { .with_stderr_data(str![[r#" [UPDATING] crates.io index [ERROR] failed to verify manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - crates cannot be published to crates.io with dependencies sourced from other - registries. `bar` needs to be published to crates.io before publishing this crate. - (crate `bar` is pulled from registry `alternative`) + | + = caused by: crates cannot be published to crates.io with dependencies sourced from other + registries. `bar` needs to be published to crates.io before publishing this crate. + (crate `bar` is pulled from registry `alternative`) "#]]) .run(); @@ -308,11 +306,10 @@ Caused by: .with_stderr_data(str![[r#" [UPDATING] crates.io index [ERROR] failed to verify manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - crates cannot be published to crates.io with dependencies sourced from other - registries. `bar` needs to be published to crates.io before publishing this crate. - (crate `bar` is pulled from registry `alternative`) + | + = caused by: crates cannot be published to crates.io with dependencies sourced from other + registries. `bar` needs to be published to crates.io before publishing this crate. + (crate `bar` is pulled from registry `alternative`) "#]]) .run(); @@ -469,7 +466,7 @@ fn block_publish_due_to_no_token() { .with_stderr_data(str![[r#" [UPDATING] `alternative` index [ERROR] no token found for `alternative`, please run `cargo login --registry alternative` -or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN + or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN "#]]) .run(); @@ -496,7 +493,7 @@ fn cargo_registries_crates_io_protocol() { .with_stderr_data(str![[r#" [UPDATING] `alternative` index [ERROR] no token found for `alternative`, please run `cargo login --registry alternative` -or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN + or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN "#]]) .run(); @@ -674,9 +671,8 @@ fn passwords_in_registries_index_url_forbidden() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] invalid index URL for registry `alternative` defined in [ROOT]/home/.cargo/config.toml - -Caused by: - registry URLs may not contain passwords + | + = caused by: registry URLs may not contain passwords "#]]) .run(); @@ -1711,12 +1707,9 @@ fn registries_index_relative_path_not_allowed() { p.cargo("check") .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - invalid index URL for registry `relative` defined in [ROOT]/.cargo/config.toml - -Caused by: - invalid url `alternative-registry`: relative URL without a base + | + = caused by: invalid index URL for registry `relative` defined in [ROOT]/.cargo/config.toml + = caused by: invalid url `alternative-registry`: relative URL without a base "#]]) .with_status(101) @@ -1885,7 +1878,7 @@ fn warn_for_unused_fields() { [UPDATING] `alternative` index [WARNING] unused config key `registries.alternative.unexpected-field` in `[ROOT]/foo/.cargo/config.toml` [ERROR] no token found for `alternative`, please run `cargo login --registry alternative` -or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN + or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN "#]]) .run(); @@ -1900,7 +1893,7 @@ or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN [UPDATING] crates.io index [WARNING] unused config key `registry.unexpected-field` in `[ROOT]/foo/.cargo/config.toml` [ERROR] no token found, please run `cargo login` -or use environment variable CARGO_REGISTRY_TOKEN + or use environment variable CARGO_REGISTRY_TOKEN "#]]) .run(); diff --git a/tests/testsuite/artifact_dep.rs b/tests/testsuite/artifact_dep.rs index 1850f6184ed..53d8143aa07 100644 --- a/tests/testsuite/artifact_dep.rs +++ b/tests/testsuite/artifact_dep.rs @@ -39,9 +39,8 @@ fn check_with_invalid_artifact_dependency() { .masquerade_as_nightly_cargo(&["bindeps"]) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - 'unknown' is not a valid artifact specifier + | + = caused by: 'unknown' is not a valid artifact specifier "#]]) .with_status(101) @@ -82,9 +81,8 @@ Caused by: cargo .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - 'lib' specifier cannot be used without an 'artifact = …' value (bar) + | + = caused by: 'lib' specifier cannot be used without an 'artifact = …' value (bar) "#]]) .with_status(101) @@ -114,9 +112,8 @@ Caused by: cargo .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - 'target' specifier cannot be used without an 'artifact = …' value (bar) + | + = caused by: 'target' specifier cannot be used without an 'artifact = …' value (bar) "#]]) .with_status(101) @@ -150,12 +147,14 @@ fn check_with_invalid_target_triple() { .masquerade_as_nightly_cargo(&["bindeps"]) .with_stderr_data(str![[r#" [ERROR] failed to run `rustc` to learn about target-specific information - -Caused by: - process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --target unknown-target-triple [..]` ([EXIT_STATUS]: 1) - --- stderr -... - + | + = caused by: process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --target unknown-target-triple --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg -Wwarnings` ([EXIT_STATUS]: 1) + --- stderr + [ERROR] error loading target specification: could not find specification for target "unknown-target-triple" + | + = [HELP] run `rustc --print target-list` for a list of built-in targets + + "#]]) .with_status(101) @@ -187,9 +186,8 @@ fn build_without_nightly_aborts_with_error() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - `artifact = …` requires `-Z bindeps` (bar) + | + = caused by: `artifact = …` requires `-Z bindeps` (bar) "#]]) .run(); @@ -2089,9 +2087,8 @@ fn check_target_equals_target_in_non_build_dependency_errors() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - `target = "target"` in normal- or dev-dependencies has no effect (bar) + | + = caused by: `target = "target"` in normal- or dev-dependencies has no effect (bar) "#]]) .run(); @@ -3305,16 +3302,16 @@ fn check_transitive_artifact_dependency_with_different_target() { .with_stderr_data(str![[r#" [LOCKING] 2 packages to latest compatible versions [ERROR] failed to determine target information for target `custom-target`. - Artifact dependency `baz` in package `bar v0.0.0 ([ROOT]/foo/bar)` requires building for `custom-target` - -Caused by: - failed to run `rustc` to learn about target-specific information - -Caused by: - process didn't exit successfully: `rustc [..] ([EXIT_STATUS]: 1) - --- stderr -... - + Artifact dependency `baz` in package `bar v0.0.0 ([ROOT]/foo/bar)` requires building for `custom-target` + | + = caused by: failed to run `rustc` to learn about target-specific information + = caused by: process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --target custom-target --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg -Wwarnings` ([EXIT_STATUS]: 1) + --- stderr + [ERROR] error loading target specification: could not find specification for target "custom-target" + | + = [HELP] run `rustc --print target-list` for a list of built-in targets + + "#]]) .with_status(101) diff --git a/tests/testsuite/artifact_dir.rs b/tests/testsuite/artifact_dir.rs index ea89a7c55ff..321d07ab230 100644 --- a/tests/testsuite/artifact_dir.rs +++ b/tests/testsuite/artifact_dir.rs @@ -194,8 +194,8 @@ fn artifact_dir_is_a_file() { .with_stderr_data(str![[r#" [COMPILING] foo v0.0.1 ([ROOT]/foo) [ERROR] failed to create directory `[ROOT]/foo/out` - -Caused by: + | + = caused by: File exists (os error 17) ... "#]]) diff --git a/tests/testsuite/bad_config.rs b/tests/testsuite/bad_config.rs index 15869bbd4c7..aabec1e8bd7 100644 --- a/tests/testsuite/bad_config.rs +++ b/tests/testsuite/bad_config.rs @@ -42,18 +42,11 @@ fn bad2() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] could not load Cargo configuration - -Caused by: - failed to load TOML configuration from `[ROOT]/foo/.cargo/config.toml` - -Caused by: - failed to parse key `http` - -Caused by: - failed to parse key `proxy` - -Caused by: - found TOML configuration value of unknown type `float` + | + = caused by: failed to load TOML configuration from `[ROOT]/foo/.cargo/config.toml` + = caused by: failed to parse key `http` + = caused by: failed to parse key `proxy` + = caused by: found TOML configuration value of unknown type `float` "#]]) .run(); @@ -79,9 +72,8 @@ fn bad3() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to update registry `crates-io` - -Caused by: - error in [ROOT]/foo/.cargo/config.toml: `http.proxy` expected a string, but found a boolean + | + = caused by: error in [ROOT]/foo/.cargo/config.toml: `http.proxy` expected a string, but found a boolean "#]]) .run(); @@ -103,9 +95,8 @@ fn bad4() { .with_stderr_data(str![[r#" [CREATING] binary (application) `foo` package [ERROR] Failed to create package `foo` at `[ROOT]/foo/foo` - -Caused by: - error in [ROOT]/foo/.cargo/config.toml: `cargo-new.vcs` expected a string, but found a boolean + | + = caused by: error in [ROOT]/foo/.cargo/config.toml: `cargo-new.vcs` expected a string, but found a boolean "#]]) .run(); @@ -131,9 +122,8 @@ fn bad6() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to update registry `crates-io` - -Caused by: - error in [ROOT]/foo/.cargo/config.toml: `http.user-agent` expected a string, but found a boolean + | + = caused by: error in [ROOT]/foo/.cargo/config.toml: `http.user-agent` expected a string, but found a boolean "#]]) .run(); @@ -163,16 +153,14 @@ fn invalid_global_config() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] could not load Cargo configuration - -Caused by: - could not parse TOML configuration in `[ROOT]/foo/.cargo/config.toml` - -Caused by: - TOML parse error at line 1, column 2 - | - 1 | 4 - | ^ - key with no value, expected `=` + | + = caused by: could not parse TOML configuration in `[ROOT]/foo/.cargo/config.toml` + = caused by: TOML parse error at line 1, column 2 + | + 1 | 4 + | ^ + key with no value, expected `=` + "#]]) .run(); @@ -189,13 +177,13 @@ fn bad_cargo_lock() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse lock file at: [ROOT]/foo/Cargo.lock - -Caused by: - TOML parse error at line 1, column 1 - | - 1 | [[package]] - | ^^^^^^^^^^^ - missing field `name` + | + = caused by: TOML parse error at line 1, column 1 + | + 1 | [[package]] + | ^^^^^^^^^^^ + missing field `name` + "#]]) .run(); @@ -247,9 +235,8 @@ fn duplicate_packages_in_cargo_lock() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse lock file at: [ROOT]/foo/Cargo.lock - -Caused by: - package `bar` is specified twice in the lockfile + | + = caused by: package `bar` is specified twice in the lockfile "#]]) .run(); @@ -296,13 +283,13 @@ fn bad_source_in_cargo_lock() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse lock file at: [ROOT]/foo/Cargo.lock - -Caused by: - TOML parse error at line 12, column 26 - | - 12 | source = "You shall not parse" - | ^^^^^^^^^^^^^^^^^^^^^ - invalid source `You shall not parse` + | + = caused by: TOML parse error at line 12, column 26 + | + 12 | source = "You shall not parse" + | ^^^^^^^^^^^^^^^^^^^^^ + invalid source `You shall not parse` + "#]]) .run(); @@ -381,18 +368,11 @@ Caused by: .with_stderr_data(str![[r#" [UPDATING] git repository `file:///` [ERROR] failed to get `foo` as a dependency of package `foo v0.0.0 ([ROOT]/foo)` - -Caused by: - failed to load source for dependency `foo` - -Caused by: - Unable to update file:/// - -Caused by: - failed to clone into: [ROOT]/home/.cargo/git/db/_empty-[HASH] - -Caused by: - 'file:///' is not a valid local file URI; class=Config (7) + | + = caused by: failed to load source for dependency `foo` + = caused by: Unable to update file:/// + = caused by: failed to clone into: [ROOT]/home/.cargo/git/db/_empty-[HASH] + = caused by: 'file:///' is not a valid local file URI; class=Config (7) "#]]) .run(); @@ -481,9 +461,8 @@ fn cargo_toml_missing_package_name() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - missing field `package.name` + | + = caused by: missing field `package.name` "#]]) .run(); @@ -518,9 +497,8 @@ fn duplicate_binary_names() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - found duplicate binary name e, but all binary targets must have a unique name + | + = caused by: found duplicate binary name e, but all binary targets must have a unique name "#]]) .run(); @@ -555,9 +533,8 @@ fn duplicate_example_names() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - found duplicate example name ex, but all example targets must have a unique name + | + = caused by: found duplicate example name ex, but all example targets must have a unique name "#]]) .run(); @@ -592,9 +569,8 @@ fn duplicate_bench_names() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - found duplicate bench name ex, but all bench targets must have a unique name + | + = caused by: found duplicate bench name ex, but all bench targets must have a unique name "#]]) .run(); @@ -630,9 +606,8 @@ fn duplicate_deps() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - Dependency 'bar' has different source paths depending on the build target. Each dependency must have a single canonical source path irrespective of build target. + | + = caused by: Dependency 'bar' has different source paths depending on the build target. Each dependency must have a single canonical source path irrespective of build target. "#]]) .run(); @@ -668,9 +643,8 @@ fn duplicate_deps_diff_sources() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - Dependency 'bar' has different source paths depending on the build target. Each dependency must have a single canonical source path irrespective of build target. + | + = caused by: Dependency 'bar' has different source paths depending on the build target. Each dependency must have a single canonical source path irrespective of build target. "#]]) .run(); @@ -805,9 +779,8 @@ fn empty_dependencies() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - dependency (bar) specified without providing a local path, Git repository, version, or workspace dependency to use + | + = caused by: dependency (bar) specified without providing a local path, Git repository, version, or workspace dependency to use "#]]) .run(); @@ -881,10 +854,9 @@ fn dev_dependencies2_2024() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - `dev_dependencies` is unsupported as of the 2024 edition; instead use `dev-dependencies` - (in the `foo` package) + | + = caused by: `dev_dependencies` is unsupported as of the 2024 edition; instead use `dev-dependencies` + (in the `foo` package) "#]]) .run(); @@ -996,10 +968,9 @@ fn build_dependencies2_2024() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - `build_dependencies` is unsupported as of the 2024 edition; instead use `build-dependencies` - (in the `foo` package) + | + = caused by: `build_dependencies` is unsupported as of the 2024 edition; instead use `build-dependencies` + (in the `foo` package) "#]]) .run(); @@ -1096,10 +1067,9 @@ fn lib_crate_type2_2024() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - `crate_type` is unsupported as of the 2024 edition; instead use `crate-type` - (in the `foo` library target) + | + = caused by: `crate_type` is unsupported as of the 2024 edition; instead use `crate-type` + (in the `foo` library target) "#]]) .run(); @@ -1188,10 +1158,9 @@ fn bin_crate_type2_2024() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - `crate_type` is unsupported as of the 2024 edition; instead use `crate-type` - (in the `foo` binary target) + | + = caused by: `crate_type` is unsupported as of the 2024 edition; instead use `crate-type` + (in the `foo` binary target) "#]]) .run(); @@ -1315,10 +1284,9 @@ fn examples_crate_type2_2024() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - `crate_type` is unsupported as of the 2024 edition; instead use `crate-type` - (in the `ex` example target) + | + = caused by: `crate_type` is unsupported as of the 2024 edition; instead use `crate-type` + (in the `ex` example target) "#]]) .run(); @@ -1449,10 +1417,9 @@ fn cargo_platform_build_dependencies2_2024() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - `build_dependencies` is unsupported as of the 2024 edition; instead use `build-dependencies` - (in the `[HOST_TARGET]` platform target) + | + = caused by: `build_dependencies` is unsupported as of the 2024 edition; instead use `build-dependencies` + (in the `[HOST_TARGET]` platform target) "#]]) .run(); @@ -1577,10 +1544,9 @@ fn cargo_platform_dev_dependencies2_2024() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - `dev_dependencies` is unsupported as of the 2024 edition; instead use `dev-dependencies` - (in the `[HOST_TARGET]` platform target) + | + = caused by: `dev_dependencies` is unsupported as of the 2024 edition; instead use `dev-dependencies` + (in the `[HOST_TARGET]` platform target) "#]]) .run(); @@ -1711,10 +1677,9 @@ fn default_features2_2024() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - `default_features` is unsupported as of the 2024 edition; instead use `default-features` - (in the `a` dependency) + | + = caused by: `default_features` is unsupported as of the 2024 edition; instead use `default-features` + (in the `a` dependency) "#]]) .run(); @@ -1917,14 +1882,11 @@ fn workspace_default_features2_2024() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to load manifest for workspace member `[ROOT]/foo/workspace_only` -referenced by workspace at `[ROOT]/foo/Cargo.toml` - -Caused by: - failed to parse manifest at `[ROOT]/foo/workspace_only/Cargo.toml` - -Caused by: - `default_features` is unsupported as of the 2024 edition; instead use `default-features` - (in the `dep_workspace_only` dependency) + referenced by workspace at `[ROOT]/foo/Cargo.toml` + | + = caused by: failed to parse manifest at `[ROOT]/foo/workspace_only/Cargo.toml` + = caused by: `default_features` is unsupported as of the 2024 edition; instead use `default-features` + (in the `dep_workspace_only` dependency) "#]]) .run(); @@ -1979,10 +1941,9 @@ fn lib_proc_macro2_2024() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - `proc_macro` is unsupported as of the 2024 edition; instead use `proc-macro` - (in the `foo` library target) + | + = caused by: `proc_macro` is unsupported as of the 2024 edition; instead use `proc-macro` + (in the `foo` library target) "#]]) .run(); @@ -2071,10 +2032,9 @@ fn bin_proc_macro2_2024() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - `proc_macro` is unsupported as of the 2024 edition; instead use `proc-macro` - (in the `foo` binary target) + | + = caused by: `proc_macro` is unsupported as of the 2024 edition; instead use `proc-macro` + (in the `foo` binary target) "#]]) .run(); @@ -2121,16 +2081,14 @@ fn invalid_toml_historically_allowed_fails() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] could not load Cargo configuration - -Caused by: - could not parse TOML configuration in `[ROOT]/foo/.cargo/config.toml` - -Caused by: - TOML parse error at line 1, column 7 - | - 1 | [bar] baz = 2 - | ^ - unexpected key or value, expected newline, `#` + | + = caused by: could not parse TOML configuration in `[ROOT]/foo/.cargo/config.toml` + = caused by: TOML parse error at line 1, column 7 + | + 1 | [bar] baz = 2 + | ^ + unexpected key or value, expected newline, `#` + "#]]) .run(); @@ -2161,9 +2119,8 @@ fn ambiguous_git_reference() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - dependency (bar) specification is ambiguous. Only one of `branch`, `tag` or `rev` is allowed. + | + = caused by: dependency (bar) specification is ambiguous. Only one of `branch`, `tag` or `rev` is allowed. "#]]) .run(); @@ -2198,16 +2155,11 @@ fn fragment_in_git_url() { [UPDATING] git repository `http://127.0.0.1/#foo` ... [ERROR] failed to get `bar` as a dependency of package `foo v0.0.0 ([ROOT]/foo)` - -Caused by: - failed to load source for dependency `bar` - -Caused by: - Unable to update http://127.0.0.1/#foo - -Caused by: - failed to clone into: [ROOT]/home/.cargo/git/db/_empty-[HASH] -... + | + = caused by: failed to load source for dependency `bar` + = caused by: Unable to update http://127.0.0.1/#foo + = caused by: failed to clone into: [ROOT]/home/.cargo/git/db/_empty-[HASH] + = caused by: failed to connect to 127.0.0.1: Connection refused; class=Os (2) "#]]) .run(); @@ -2260,15 +2212,10 @@ fn bad_source_config2() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to get `bar` as a dependency of package `foo v0.0.0 ([ROOT]/foo)` - -Caused by: - failed to load source for dependency `bar` - -Caused by: - Unable to update registry `crates-io` - -Caused by: - could not find a configured source with the name `bar` when attempting to lookup `crates-io` (configuration in `[ROOT]/foo/.cargo/config.toml`) + | + = caused by: failed to load source for dependency `bar` + = caused by: Unable to update registry `crates-io` + = caused by: could not find a configured source with the name `bar` when attempting to lookup `crates-io` (configuration in `[ROOT]/foo/.cargo/config.toml`) "#]]) .run(); @@ -2305,15 +2252,10 @@ fn bad_source_config3() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to get `bar` as a dependency of package `foo v0.0.0 ([ROOT]/foo)` - -Caused by: - failed to load source for dependency `bar` - -Caused by: - Unable to update registry `crates-io` - -Caused by: - detected a cycle of `replace-with` sources, the source `crates-io` is eventually replaced with itself (configuration in `[ROOT]/foo/.cargo/config.toml`) + | + = caused by: failed to load source for dependency `bar` + = caused by: Unable to update registry `crates-io` + = caused by: detected a cycle of `replace-with` sources, the source `crates-io` is eventually replaced with itself (configuration in `[ROOT]/foo/.cargo/config.toml`) "#]]) .run(); @@ -2353,15 +2295,10 @@ fn bad_source_config4() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to get `bar` as a dependency of package `foo v0.0.0 ([ROOT]/foo)` - -Caused by: - failed to load source for dependency `bar` - -Caused by: - Unable to update registry `crates-io` - -Caused by: - detected a cycle of `replace-with` sources, the source `crates-io` is eventually replaced with itself (configuration in `[ROOT]/foo/.cargo/config.toml`) + | + = caused by: failed to load source for dependency `bar` + = caused by: Unable to update registry `crates-io` + = caused by: detected a cycle of `replace-with` sources, the source `crates-io` is eventually replaced with itself (configuration in `[ROOT]/foo/.cargo/config.toml`) "#]]) .run(); @@ -2401,9 +2338,8 @@ fn bad_source_config5() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] configuration key `source.bar.registry` specified an invalid URL (in [ROOT]/foo/.cargo/config.toml) - -Caused by: - invalid url `not a url`: relative URL without a base + | + = caused by: invalid url `not a url`: relative URL without a base "#]]) .run(); @@ -2433,9 +2369,8 @@ fn both_git_and_path_specified() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - dependency (bar) specification is ambiguous. Only one of `git` or `path` is allowed. + | + = caused by: dependency (bar) specification is ambiguous. Only one of `git` or `path` is allowed. "#]]) .run(); @@ -2472,9 +2407,8 @@ fn bad_source_config6() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] error in [ROOT]/foo/.cargo/config.toml: could not load config key `source.crates-io.replace-with` - -Caused by: - error in [ROOT]/foo/.cargo/config.toml: `source.crates-io.replace-with` expected a string, but found a array + | + = caused by: error in [ROOT]/foo/.cargo/config.toml: `source.crates-io.replace-with` expected a string, but found a array "#]]) .run(); @@ -2504,9 +2438,8 @@ fn ignored_git_revision() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - key `branch` is ignored for dependency (bar). + | + = caused by: key `branch` is ignored for dependency (bar). "#]]) .run(); @@ -2528,9 +2461,8 @@ Caused by: .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - key `branch` is ignored for dependency (bar). + | + = caused by: key `branch` is ignored for dependency (bar). "#]]) .run(); @@ -2818,9 +2750,8 @@ fn bad_http_ssl_version() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] error in [ROOT]/foo/.cargo/config.toml: could not load config key `http.ssl-version` - -Caused by: - invalid type: sequence, expected a string or map + | + = caused by: invalid type: sequence, expected a string or map "#]]) .run(); @@ -2844,9 +2775,8 @@ fn bad_http_ssl_version_range() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] error in [ROOT]/foo/.cargo/config.toml: could not load config key `http.ssl-version` - -Caused by: - error in [ROOT]/foo/.cargo/config.toml: `http.ssl-version.min` expected a string, but found a boolean + | + = caused by: error in [ROOT]/foo/.cargo/config.toml: `http.ssl-version.min` expected a string, but found a boolean "#]]) .run(); @@ -2870,9 +2800,8 @@ fn bad_build_jobs() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] error in [ROOT]/foo/.cargo/config.toml: could not load config key `build.jobs` - -Caused by: - invalid type: map, expected an integer or string + | + = caused by: invalid type: map, expected an integer or string "#]]) .run(); @@ -2896,12 +2825,9 @@ fn bad_build_target() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] error in [ROOT]/foo/.cargo/config.toml: could not load config key `build.target` - -Caused by: - error in [ROOT]/foo/.cargo/config.toml: could not load config key `build.target` - -Caused by: - invalid type: map, expected a string or array + | + = caused by: error in [ROOT]/foo/.cargo/config.toml: could not load config key `build.target` + = caused by: invalid type: map, expected a string or array "#]]) .run(); @@ -2931,13 +2857,10 @@ fn bad_target_cfg() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] error in [ROOT]/foo/.cargo/config.toml: could not load config key `target.'cfg(not(target_os = "none"))'.runner` - -Caused by: - error in [ROOT]/foo/.cargo/config.toml: could not load config key `target.'cfg(not(target_os = "none"))'.runner` - -Caused by: - invalid configuration for key `target.'cfg(not(target_os = "none"))'.runner` - expected a string or array of strings, but found a boolean for `target.'cfg(not(target_os = "none"))'.runner` in [ROOT]/foo/.cargo/config.toml + | + = caused by: error in [ROOT]/foo/.cargo/config.toml: could not load config key `target.'cfg(not(target_os = "none"))'.runner` + = caused by: invalid configuration for key `target.'cfg(not(target_os = "none"))'.runner` + expected a string or array of strings, but found a boolean for `target.'cfg(not(target_os = "none"))'.runner` in [ROOT]/foo/.cargo/config.toml "#]]) .run(); @@ -3009,7 +2932,7 @@ fn redefined_sources() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] source `foo` defines source registry `crates-io`, but that source is already defined by `crates-io` -[NOTE] Sources are not allowed to be defined multiple times. + [NOTE] Sources are not allowed to be defined multiple times. "#]]) .run(); @@ -3030,7 +2953,7 @@ fn redefined_sources() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] source `[..]` defines source dir [ROOT]/foo/index, but that source is already defined by `[..]` -[NOTE] Sources are not allowed to be defined multiple times. + [NOTE] Sources are not allowed to be defined multiple times. "#]]) .run(); @@ -3095,11 +3018,10 @@ fn bad_bin_name() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - can't find `bin.rs` bin at `src/bin/bin.rs.rs` or `src/bin/bin.rs/main.rs`. Please specify bin.path if you want to use a non-default path. - - [HELP] a bin with a similar name exists: `bin` + | + = caused by: can't find `bin.rs` bin at `src/bin/bin.rs.rs` or `src/bin/bin.rs/main.rs`. Please specify bin.path if you want to use a non-default path. + + [HELP] a bin with a similar name exists: `bin` "#]]) .run(); @@ -3112,11 +3034,10 @@ fn bad_example_name() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - can't find `example.rs` example at `examples/example.rs.rs` or `examples/example.rs/main.rs`. Please specify example.path if you want to use a non-default path. - - [HELP] a example with a similar name exists: `example` + | + = caused by: can't find `example.rs` example at `examples/example.rs.rs` or `examples/example.rs/main.rs`. Please specify example.path if you want to use a non-default path. + + [HELP] a example with a similar name exists: `example` "#]]) .run(); @@ -3129,11 +3050,10 @@ fn bad_test_name() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - can't find `test.rs` test at `tests/test.rs.rs` or `tests/test.rs/main.rs`. Please specify test.path if you want to use a non-default path. - - [HELP] a test with a similar name exists: `test` + | + = caused by: can't find `test.rs` test at `tests/test.rs.rs` or `tests/test.rs/main.rs`. Please specify test.path if you want to use a non-default path. + + [HELP] a test with a similar name exists: `test` "#]]) .run(); @@ -3146,11 +3066,10 @@ fn bad_bench_name() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - can't find `bench.rs` bench at `benches/bench.rs.rs` or `benches/bench.rs/main.rs`. Please specify bench.path if you want to use a non-default path. - - [HELP] a bench with a similar name exists: `bench` + | + = caused by: can't find `bench.rs` bench at `benches/bench.rs.rs` or `benches/bench.rs/main.rs`. Please specify bench.path if you want to use a non-default path. + + [HELP] a bench with a similar name exists: `bench` "#]]) .run(); @@ -3182,9 +3101,8 @@ fn non_existing_test() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - can't find `hello` test at `tests/hello.rs` or `tests/hello/main.rs`. Please specify test.path if you want to use a non-default path. + | + = caused by: can't find `hello` test at `tests/hello.rs` or `tests/hello/main.rs`. Please specify test.path if you want to use a non-default path. "#]]) .run(); @@ -3216,9 +3134,8 @@ fn non_existing_example() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - can't find `hello` example at `examples/hello.rs` or `examples/hello/main.rs`. Please specify example.path if you want to use a non-default path. + | + = caused by: can't find `hello` example at `examples/hello.rs` or `examples/hello/main.rs`. Please specify example.path if you want to use a non-default path. "#]]) .run(); @@ -3250,9 +3167,8 @@ fn non_existing_benchmark() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - can't find `hello` bench at `benches/hello.rs` or `benches/hello/main.rs`. Please specify bench.path if you want to use a non-default path. + | + = caused by: can't find `hello` bench at `benches/hello.rs` or `benches/hello/main.rs`. Please specify bench.path if you want to use a non-default path. "#]]) .run(); @@ -3270,11 +3186,10 @@ fn non_existing_binary() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - can't find `foo` bin at `src/bin/foo.rs` or `src/bin/foo/main.rs`. Please specify bin.path if you want to use a non-default path. - - [HELP] a bin with a similar name exists: `ehlo` + | + = caused by: can't find `foo` bin at `src/bin/foo.rs` or `src/bin/foo/main.rs`. Please specify bin.path if you want to use a non-default path. + + [HELP] a bin with a similar name exists: `ehlo` "#]]) .run(); @@ -3307,10 +3222,9 @@ fn commonly_wrong_path_of_test() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - can't find `foo` test at default paths, but found a file at `test/foo.rs`. - Perhaps rename the file to `tests/foo.rs` for target auto-discovery, or specify test.path if you want to use a non-default path. + | + = caused by: can't find `foo` test at default paths, but found a file at `test/foo.rs`. + Perhaps rename the file to `tests/foo.rs` for target auto-discovery, or specify test.path if you want to use a non-default path. "#]]) .run(); @@ -3343,10 +3257,9 @@ fn commonly_wrong_path_of_example() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - can't find `foo` example at default paths, but found a file at `example/foo.rs`. - Perhaps rename the file to `examples/foo.rs` for target auto-discovery, or specify example.path if you want to use a non-default path. + | + = caused by: can't find `foo` example at default paths, but found a file at `example/foo.rs`. + Perhaps rename the file to `examples/foo.rs` for target auto-discovery, or specify example.path if you want to use a non-default path. "#]]) .run(); @@ -3379,10 +3292,9 @@ fn commonly_wrong_path_of_benchmark() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - can't find `foo` bench at default paths, but found a file at `bench/foo.rs`. - Perhaps rename the file to `benches/foo.rs` for target auto-discovery, or specify bench.path if you want to use a non-default path. + | + = caused by: can't find `foo` bench at default paths, but found a file at `bench/foo.rs`. + Perhaps rename the file to `benches/foo.rs` for target auto-discovery, or specify bench.path if you want to use a non-default path. "#]]) .run(); @@ -3400,10 +3312,9 @@ fn commonly_wrong_path_binary() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - can't find `foo` bin at default paths, but found a file at `src/bins/foo.rs`. - Perhaps rename the file to `src/bin/foo.rs` for target auto-discovery, or specify bin.path if you want to use a non-default path. + | + = caused by: can't find `foo` bin at default paths, but found a file at `src/bins/foo.rs`. + Perhaps rename the file to `src/bin/foo.rs` for target auto-discovery, or specify bin.path if you want to use a non-default path. "#]]) .run(); @@ -3421,10 +3332,9 @@ fn commonly_wrong_path_subdir_binary() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - can't find `foo` bin at default paths, but found a file at `src/bins/foo/main.rs`. - Perhaps rename the file to `src/bin/foo/main.rs` for target auto-discovery, or specify bin.path if you want to use a non-default path. + | + = caused by: can't find `foo` bin at default paths, but found a file at `src/bins/foo/main.rs`. + Perhaps rename the file to `src/bin/foo/main.rs` for target auto-discovery, or specify bin.path if you want to use a non-default path. "#]]) .run(); @@ -3444,10 +3354,9 @@ fn found_multiple_target_files() { // Don't assert the inferred paths since the order is non-deterministic. .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - cannot infer path for `foo` bin - Cargo doesn't know which to use because multiple target files found at `src/bin/foo[..]rs` and `src/bin/foo[..].rs`. + | + = caused by: cannot infer path for `foo` bin + Cargo doesn't know which to use because multiple target files found at `src/bin/foo.rs` and `src/bin/foo/main.rs`. "#]]) .run(); diff --git a/tests/testsuite/bench.rs b/tests/testsuite/bench.rs index a11822a5e3c..bd440556d00 100644 --- a/tests/testsuite/bench.rs +++ b/tests/testsuite/bench.rs @@ -1443,8 +1443,8 @@ fn test_bench_no_fail_fast() { [RUNNING] benches/b1.rs (target/release/deps/b1-[HASH][EXE]) [ERROR] bench failed, to rerun pass `--bench b1` [ERROR] 2 targets failed: - `--bin foo` - `--bench b1` + `--bin foo` + `--bench b1` "#]]) .with_stdout_data( diff --git a/tests/testsuite/binary_name.rs b/tests/testsuite/binary_name.rs index f1e04004cb7..75ff9d3d165 100644 --- a/tests/testsuite/binary_name.rs +++ b/tests/testsuite/binary_name.rs @@ -34,13 +34,13 @@ fn gated() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - feature `different-binary-name` is required - - The package requires the Cargo feature called `different-binary-name`, but that feature is not stabilized in this version of Cargo ([..]). - Consider adding `cargo-features = ["different-binary-name"]` to the top of Cargo.toml (above the [package] table) to tell Cargo you are opting in to use this unstable feature. - See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#different-binary-name for more information about the status of this feature. + | + = caused by: feature `different-binary-name` is required + + The package requires the Cargo feature called `different-binary-name`, but that feature is not stabilized in this version of Cargo (1.91.0 (3eafc35f1 2025-09-03)). + Consider adding `cargo-features = ["different-binary-name"]` to the top of Cargo.toml (above the [package] table) to tell Cargo you are opting in to use this unstable feature. + See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#different-binary-name for more information about the status of this feature. + "#]]) .run(); diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 68a3a037911..92dbf4c7428 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -372,16 +372,14 @@ fn cargo_compile_directory_not_cwd_with_invalid_config() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] could not load Cargo configuration - -Caused by: - could not parse TOML configuration in `[ROOT]/foo/.cargo/config.toml` - -Caused by: - TOML parse error at line 1, column 2 - | - 1 | ! - | ^ - key with no value, expected `=` + | + = caused by: could not parse TOML configuration in `[ROOT]/foo/.cargo/config.toml` + = caused by: TOML parse error at line 1, column 2 + | + 1 | ! + | ^ + key with no value, expected `=` + "#]]) .run(); @@ -395,9 +393,8 @@ fn cargo_compile_with_invalid_manifest() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - manifest is missing either a `[package]` or a `[workspace]` + | + = caused by: manifest is missing either a `[package]` or a `[workspace]` "#]]) .run(); @@ -559,9 +556,8 @@ fn cargo_compile_with_invalid_bin_target_name() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - binary target names cannot be empty + | + = caused by: binary target names cannot be empty "#]]) .run(); @@ -589,9 +585,8 @@ fn cargo_compile_with_forbidden_bin_target_name() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - the binary target name `build` is forbidden, it conflicts with cargo's build directory names + | + = caused by: the binary target name `build` is forbidden, it conflicts with cargo's build directory names "#]]) .run(); @@ -622,9 +617,8 @@ fn cargo_compile_with_bin_and_crate_type() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - the target `the_foo_bin` is a binary and can't have any crate-types set (currently "cdylib, rlib") + | + = caused by: the target `the_foo_bin` is a binary and can't have any crate-types set (currently "cdylib, rlib") "#]]) .run(); @@ -710,9 +704,8 @@ fn cargo_compile_with_bin_and_proc() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - the target `the_foo_bin` is a binary and can't have `proc-macro` set `true` + | + = caused by: the target `the_foo_bin` is a binary and can't have `proc-macro` set `true` "#]]) .run(); @@ -740,9 +733,8 @@ fn cargo_compile_with_invalid_lib_target_name() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - library target names cannot be empty + | + = caused by: library target names cannot be empty "#]]) .run(); @@ -770,12 +762,9 @@ fn cargo_compile_with_invalid_non_numeric_dep_version() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - failed to parse the version requirement `y` for dependency `crossbeam` - -Caused by: - unexpected character 'y' while parsing major version number + | + = caused by: failed to parse the version requirement `y` for dependency `crossbeam` + = caused by: unexpected character 'y' while parsing major version number "#]]) .run(); @@ -1278,8 +1267,8 @@ fn cargo_compile_with_dep_name_mismatch() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] no matching package named `notquitebar` found -location searched: [ROOT]/foo/bar -required by package `foo v0.0.1 ([ROOT]/foo)` + location searched: [ROOT]/foo/bar + required by package `foo v0.0.1 ([ROOT]/foo)` "#]]) .run(); @@ -1335,8 +1324,8 @@ fn cargo_compile_with_filename() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] no bin target named `bin.rs` in default-run packages -[HELP] available bin targets: - a + [HELP] available bin targets: + a "#]]) .run(); @@ -1345,8 +1334,8 @@ fn cargo_compile_with_filename() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] no bin target named `a.rs` in default-run packages - -[HELP] a target with a similar name exists: `a` + + [HELP] a target with a similar name exists: `a` "#]]) .run(); @@ -1355,8 +1344,8 @@ fn cargo_compile_with_filename() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] no example target named `example.rs` in default-run packages -[HELP] available example targets: - a + [HELP] available example targets: + a "#]]) .run(); @@ -1365,8 +1354,8 @@ fn cargo_compile_with_filename() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] no example target named `a.rs` in default-run packages - -[HELP] a target with a similar name exists: `a` + + [HELP] a target with a similar name exists: `a` "#]]) .run(); @@ -1408,17 +1397,17 @@ fn incompatible_dependencies() { .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [ERROR] failed to select a version for `bad`. - ... required by package `qux v0.1.0` - ... which satisfies dependency `qux = "^0.1.0"` of package `foo v0.0.1 ([ROOT]/foo)` -versions that meet the requirements `>=1.0.1` are: 1.0.2, 1.0.1 - -all possible versions conflict with previously selected packages. - - previously selected package `bad v1.0.0` - ... which satisfies dependency `bad = "=1.0.0"` of package `baz v0.1.0` - ... which satisfies dependency `baz = "^0.1.0"` of package `foo v0.0.1 ([ROOT]/foo)` - -failed to select a version for `bad` which could resolve this conflict + ... required by package `qux v0.1.0` + ... which satisfies dependency `qux = "^0.1.0"` of package `foo v0.0.1 ([ROOT]/foo)` + versions that meet the requirements `>=1.0.1` are: 1.0.2, 1.0.1 + + all possible versions conflict with previously selected packages. + + previously selected package `bad v1.0.0` + ... which satisfies dependency `bad = "=1.0.0"` of package `baz v0.1.0` + ... which satisfies dependency `baz = "^0.1.0"` of package `foo v0.0.1 ([ROOT]/foo)` + + failed to select a version for `bad` which could resolve this conflict "#]]) .run(); @@ -1456,20 +1445,20 @@ fn incompatible_dependencies_with_multi_semver() { .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [ERROR] failed to select a version for `bad`. - ... required by package `foo v0.0.1 ([ROOT]/foo)` -versions that meet the requirements `>=1.0.1, <=2.0.0` are: 2.0.0, 1.0.1 - -all possible versions conflict with previously selected packages. - - previously selected package `bad v2.0.1` - ... which satisfies dependency `bad = ">=2.0.1"` of package `baz v0.1.0` - ... which satisfies dependency `baz = "^0.1.0"` of package `foo v0.0.1 ([ROOT]/foo)` - - previously selected package `bad v1.0.0` - ... which satisfies dependency `bad = "=1.0.0"` of package `bar v0.1.0` - ... which satisfies dependency `bar = "^0.1.0"` of package `foo v0.0.1 ([ROOT]/foo)` - -failed to select a version for `bad` which could resolve this conflict + ... required by package `foo v0.0.1 ([ROOT]/foo)` + versions that meet the requirements `>=1.0.1, <=2.0.0` are: 2.0.0, 1.0.1 + + all possible versions conflict with previously selected packages. + + previously selected package `bad v2.0.1` + ... which satisfies dependency `bad = ">=2.0.1"` of package `baz v0.1.0` + ... which satisfies dependency `baz = "^0.1.0"` of package `foo v0.0.1 ([ROOT]/foo)` + + previously selected package `bad v1.0.0` + ... which satisfies dependency `bad = "=1.0.0"` of package `bar v0.1.0` + ... which satisfies dependency `bar = "^0.1.0"` of package `foo v0.0.1 ([ROOT]/foo)` + + failed to select a version for `bad` which could resolve this conflict "#]]) .run(); @@ -2057,9 +2046,8 @@ fn set_both_dylib_and_cdylib_crate_types() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - library `foo` cannot set the crate type of both `dylib` and `cdylib` + | + = caused by: library `foo` cannot set the crate type of both `dylib` and `cdylib` "#]]) .run(); @@ -2093,8 +2081,8 @@ fn self_dependency() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] cyclic package dependency: package `test v0.0.0 ([ROOT]/foo)` depends on itself. Cycle: -package `test v0.0.0 ([ROOT]/foo)` - ... which satisfies path dependency `test` of package `test v0.0.0 ([ROOT]/foo)` + package `test v0.0.0 ([ROOT]/foo)` + ... which satisfies path dependency `test` of package `test v0.0.0 ([ROOT]/foo)` "#]]) .run(); @@ -2145,10 +2133,9 @@ fn missing_lib_and_bin() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - no targets specified in the manifest - either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present + | + = caused by: no targets specified in the manifest + either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present "#]]) .run(); @@ -2723,16 +2710,14 @@ fn bad_cargo_config() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] could not load Cargo configuration - -Caused by: - could not parse TOML configuration in `[ROOT]/foo/.cargo/config.toml` - -Caused by: - TOML parse error at line 1, column 6 - | - 1 | this is not valid toml - | ^ - key with no value, expected `=` + | + = caused by: could not parse TOML configuration in `[ROOT]/foo/.cargo/config.toml` + = caused by: TOML parse error at line 1, column 6 + | + 1 | this is not valid toml + | ^ + key with no value, expected `=` + "#]]) .run(); @@ -3054,9 +3039,8 @@ fn transitive_dependencies_not_available() { error[E0463]: can't find crate for `bbbbb` ... [ERROR] could not compile `foo` (bin "foo") due to 1 previous error - -Caused by: - process didn't exit successfully: `rustc [..]` ([EXIT_STATUS]: 1) + | + = caused by: process didn't exit successfully: `rustc --crate-name foo --edition=2015 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=1e2b9fbed8cc006d -C extra-filename=-385fad4a6fb846cd --out-dir [ROOT]/foo/target/debug/deps -L dependency=[ROOT]/foo/target/debug/deps --extern aaaaa=[ROOT]/foo/target/debug/deps/libaaaaa-[HASH].rlib` ([EXIT_STATUS]: 1) "#]]) .run(); @@ -3099,9 +3083,9 @@ fn cyclic_deps_rejected() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] cyclic package dependency: package `a v0.0.1 ([ROOT]/foo/a)` depends on itself. Cycle: -package `a v0.0.1 ([ROOT]/foo/a)` - ... which satisfies path dependency `a` of package `foo v0.0.1 ([ROOT]/foo)` - ... which satisfies path dependency `foo` of package `a v0.0.1 ([ROOT]/foo/a)` + package `a v0.0.1 ([ROOT]/foo/a)` + ... which satisfies path dependency `a` of package `foo v0.0.1 ([ROOT]/foo)` + ... which satisfies path dependency `foo` of package `a v0.0.1 ([ROOT]/foo/a)` "#]]) .run(); @@ -3169,9 +3153,8 @@ fn dashes_in_crate_name_bad() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - library target names cannot contain hyphens: foo-bar + | + = caused by: library target names cannot contain hyphens: foo-bar "#]]) .run(); @@ -3186,9 +3169,8 @@ fn rustc_env_var() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] could not execute process `rustc-that-does-not-exist -vV` (never executed) - -Caused by: - [..] + | + = caused by: [NOT_FOUND] "#]]) .run(); @@ -4033,8 +4015,8 @@ fn build_all_exclude_broken_glob() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] cannot build glob pattern from `[*z` - -Caused by: + | + = caused by: Pattern syntax error near position 0: invalid range pattern ... "#]]) @@ -4240,8 +4222,8 @@ fn build_virtual_manifest_broken_glob() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] cannot build glob pattern from `[*z` - -Caused by: + | + = caused by: Pattern syntax error near position 0: invalid range pattern ... "#]]) @@ -4617,9 +4599,8 @@ fn rustc_wrapper_from_path() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] could not execute process `wannabe_sccache rustc -vV` (never executed) - -Caused by: - [..] + | + = caused by: [NOT_FOUND] "#]]) .run(); @@ -4629,9 +4610,8 @@ Caused by: .with_status(101) .with_stderr_data(str![[r#" [ERROR] could not execute process `wannabe_sccache rustc -vV` (never executed) - -Caused by: - [..] + | + = caused by: [NOT_FOUND] "#]]) .run(); @@ -4855,9 +4835,8 @@ fn no_bin_in_src_with_lib() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - can't find `foo` bin at `src/bin/foo.rs` or `src/bin/foo/main.rs`. Please specify bin.path if you want to use a non-default path. + | + = caused by: can't find `foo` bin at `src/bin/foo.rs` or `src/bin/foo/main.rs`. Please specify bin.path if you want to use a non-default path. "#]]) .run(); @@ -4890,9 +4869,8 @@ fn inferred_bins_duplicate_name() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - found duplicate binary name bar, but all binary targets must have a unique name + | + = caused by: found duplicate binary name bar, but all binary targets must have a unique name "#]]) .run(); @@ -5095,12 +5073,9 @@ fn building_a_dependent_crate_without_bin_should_fail() { [DOWNLOADING] crates ... [DOWNLOADED] testless v0.1.0 (registry `dummy-registry`) [ERROR] failed to download replaced source registry `crates-io` - -Caused by: - failed to parse manifest at `[ROOT]/home/.cargo/registry/src/-[HASH]/testless-0.1.0/Cargo.toml` - -Caused by: - can't find `a_bin` bin at `src/bin/a_bin.rs` or `src/bin/a_bin/main.rs`. Please specify bin.path if you want to use a non-default path. + | + = caused by: failed to parse manifest at `[ROOT]/home/.cargo/registry/src/-[HASH]/testless-0.1.0/Cargo.toml` + = caused by: can't find `a_bin` bin at `src/bin/a_bin.rs` or `src/bin/a_bin/main.rs`. Please specify bin.path if you want to use a non-default path. "#]]) .run(); @@ -5369,8 +5344,8 @@ fn avoid_dev_deps() { .with_stderr_data(str![[r#" [UPDATING] `dummy-registry` index [ERROR] no matching package named `baz` found -location searched: `dummy-registry` index (which is replacing registry `crates-io`) -required by package `bar v0.1.0 ([ROOT]/foo)` + location searched: `dummy-registry` index (which is replacing registry `crates-io`) + required by package `bar v0.1.0 ([ROOT]/foo)` "#]]) .run(); @@ -5491,8 +5466,8 @@ fn target_filters_workspace() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] no example target named `ex` in default-run packages - -[HELP] a target with a similar name exists: `ex1` + + [HELP] a target with a similar name exists: `ex1` "#]]) .run(); @@ -5501,8 +5476,8 @@ fn target_filters_workspace() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] no example target matches pattern `ex??` in default-run packages - -[HELP] a target with a similar name exists: `ex1` + + [HELP] a target with a similar name exists: `ex1` "#]]) .run(); @@ -5614,9 +5589,8 @@ fn signal_display() { [COMPILING] pm v0.1.0 ([ROOT]/foo/pm) [COMPILING] foo v0.1.0 ([ROOT]/foo) [ERROR] could not compile `foo` (lib) - -Caused by: - process didn't exit successfully: `rustc [..]` (signal: 6, SIGABRT: process abort signal) + | + = caused by: process didn't exit successfully: `rustc --crate-name foo --edition=2015 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=55453278b0f49684 -C extra-filename=-4b0dee79e002e527 --out-dir [ROOT]/foo/target/debug/deps -L dependency=[ROOT]/foo/target/debug/deps --extern pm=[ROOT]/foo/target/debug/deps/libpm-[HASH].so` (signal: 6, SIGABRT: process abort signal) "#]]) .with_status(101) @@ -6183,9 +6157,8 @@ fn simple_terminal_width() { error[E0308][..] ... [ERROR] could not compile `foo` (lib) due to 1 previous error - -Caused by: - process didn't exit successfully: `rustc [..]` ([EXIT_STATUS]: 1) + | + = caused by: process didn't exit successfully: `rustc --crate-name foo --edition=2015 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=20 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=88f4df7e68c96ebb -C extra-filename=-5ac581d057822bf6 --out-dir [ROOT]/foo/target/debug/deps -L dependency=[ROOT]/foo/target/debug/deps` ([EXIT_STATUS]: 1) "#]]) .run(); diff --git a/tests/testsuite/build_dir.rs b/tests/testsuite/build_dir.rs index d3b8941a268..b1fb7333227 100644 --- a/tests/testsuite/build_dir.rs +++ b/tests/testsuite/build_dir.rs @@ -479,8 +479,8 @@ fn template_should_error_for_invalid_variables() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] unexpected variable `fake` in build.build-dir path `{fake}/build-dir` - -[HELP] available template variables are `{workspace-root}`, `{cargo-cache-home}`, `{workspace-path-hash}` + + [HELP] available template variables are `{workspace-root}`, `{cargo-cache-home}`, `{workspace-path-hash}` "#]]) .run(); @@ -503,8 +503,8 @@ fn template_should_suggest_nearest_variable() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] unexpected variable `workspace-ro` in build.build-dir path `{workspace-ro}/build-dir` - -[HELP] a template variable with a similar name exists: `workspace-root` + + [HELP] a template variable with a similar name exists: `workspace-root` "#]]) .run(); diff --git a/tests/testsuite/build_script.rs b/tests/testsuite/build_script.rs index e480295ff44..f3e0e43fd16 100644 --- a/tests/testsuite/build_script.rs +++ b/tests/testsuite/build_script.rs @@ -44,9 +44,8 @@ fn custom_build_script_failed() { [RUNNING] `rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin [..]` [RUNNING] `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build` [ERROR] failed to run custom build command for `foo v0.5.0 ([ROOT]/foo)` - -Caused by: - process didn't exit successfully: `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build` ([EXIT_STATUS]: 101) + | + = caused by: process didn't exit successfully: `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build` ([EXIT_STATUS]: 101) "#]]) .run(); @@ -82,10 +81,9 @@ fn custom_build_script_failed_backtraces_message() { [RUNNING] `rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin [..]` [RUNNING] `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build` [ERROR] failed to run custom build command for `foo v0.5.0 ([ROOT]/foo)` -[NOTE] To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation. - -Caused by: - process didn't exit successfully: `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build` ([EXIT_STATUS]: 101) + [NOTE] To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation. + | + = caused by: process didn't exit successfully: `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build` ([EXIT_STATUS]: 101) "#]]) .run(); @@ -97,10 +95,9 @@ Caused by: [COMPILING] foo v0.5.0 ([ROOT]/foo) [RUNNING] `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build` [ERROR] failed to run custom build command for `foo v0.5.0 ([ROOT]/foo)` -[NOTE] To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation. - -Caused by: - process didn't exit successfully: `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build` ([EXIT_STATUS]: 101) + [NOTE] To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation. + | + = caused by: process didn't exit successfully: `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build` ([EXIT_STATUS]: 101) "#]]) .run(); @@ -136,9 +133,8 @@ fn custom_build_script_failed_backtraces_message_with_debuginfo() { [RUNNING] `rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin [..]` [RUNNING] `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build` [ERROR] failed to run custom build command for `foo v0.5.0 ([ROOT]/foo)` - -Caused by: - process didn't exit successfully: `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build` ([EXIT_STATUS]: 101) + | + = caused by: process didn't exit successfully: `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build` ([EXIT_STATUS]: 101) "#]]) .run(); @@ -982,9 +978,8 @@ fn links_no_build_cmd() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - package specifies that it links to `a` but does not have a custom build script + | + = caused by: package specifies that it links to `a` but does not have a custom build script "#]]) .run(); @@ -1031,14 +1026,14 @@ fn links_duplicates() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to select a version for `a-sys`. - ... required by package `foo v0.5.0 ([ROOT]/foo)` -versions that meet the requirements `*` are: 0.5.0 - -package `a-sys` links to the native library `a`, but it conflicts with a previous package which links to `a` as well: -package `foo v0.5.0 ([ROOT]/foo)` -Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the `links = "a"` value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links. - -failed to select a version for `a-sys` which could resolve this conflict + ... required by package `foo v0.5.0 ([ROOT]/foo)` + versions that meet the requirements `*` are: 0.5.0 + + package `a-sys` links to the native library `a`, but it conflicts with a previous package which links to `a` as well: + package `foo v0.5.0 ([ROOT]/foo)` + Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the `links = "a"` value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links. + + failed to select a version for `a-sys` which could resolve this conflict "#]]) .run(); @@ -1088,13 +1083,13 @@ fn links_duplicates_old_registry() { [DOWNLOADING] crates ... [DOWNLOADED] bar v0.1.0 (registry `dummy-registry`) [ERROR] multiple packages link to native library `a`, but a native library can be linked only once - -package `bar v0.1.0` - ... which satisfies dependency `bar = "^0.1"` (locked to 0.1.0) of package `foo v0.1.0 ([ROOT]/foo)` -links to native library `a` - -package `foo v0.1.0 ([ROOT]/foo)` -also links to native library `a` + + package `bar v0.1.0` + ... which satisfies dependency `bar = "^0.1"` (locked to 0.1.0) of package `foo v0.1.0 ([ROOT]/foo)` + links to native library `a` + + package `foo v0.1.0 ([ROOT]/foo)` + also links to native library `a` "#]]) .run(); @@ -1157,15 +1152,15 @@ fn links_duplicates_deep_dependency() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to select a version for `a-sys`. - ... required by package `a v0.5.0 ([ROOT]/foo/a)` - ... which satisfies path dependency `a` of package `foo v0.5.0 ([ROOT]/foo)` -versions that meet the requirements `*` are: 0.5.0 - -package `a-sys` links to the native library `a`, but it conflicts with a previous package which links to `a` as well: -package `foo v0.5.0 ([ROOT]/foo)` -Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the `links = "a"` value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links. - -failed to select a version for `a-sys` which could resolve this conflict + ... required by package `a v0.5.0 ([ROOT]/foo/a)` + ... which satisfies path dependency `a` of package `foo v0.5.0 ([ROOT]/foo)` + versions that meet the requirements `*` are: 0.5.0 + + package `a-sys` links to the native library `a`, but it conflicts with a previous package which links to `a` as well: + package `foo v0.5.0 ([ROOT]/foo)` + Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the `links = "a"` value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links. + + failed to select a version for `a-sys` which could resolve this conflict "#]]) .run(); @@ -1765,8 +1760,6 @@ fn build_deps_not_for_normal() { error[E0463]: can't find crate for `aaaaa` [ERROR] could not compile `foo` (lib) due to 1 previous error -Caused by: - process didn't exit successfully: `rustc --crate-name foo[..]` ([EXIT_STATUS]: 1) "#]] .unordered(), @@ -2106,10 +2099,9 @@ fn build_script_only() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - no targets specified in the manifest - either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present + | + = caused by: no targets specified in the manifest + either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present "#]]) .run(); @@ -4030,14 +4022,14 @@ fn warnings_emitted_when_build_script_panics() { [WARNING] foo@0.5.0: foo [WARNING] foo@0.5.0: bar [ERROR] failed to run custom build command for `foo v0.5.0 ([ROOT]/foo)` - -Caused by: - process didn't exit successfully: `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build` ([EXIT_STATUS]: 101) - --- stdout - cargo::warning=foo - cargo::warning=bar - - --- stderr + | + = caused by: process didn't exit successfully: `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build` ([EXIT_STATUS]: 101) + --- stdout + cargo::warning=foo + cargo::warning=bar + + --- stderr + ... [..]our crate panicked[..] ... @@ -4100,14 +4092,14 @@ fn warnings_emitted_when_dependency_panics() { [WARNING] published@0.1.0: foo [WARNING] published@0.1.0: bar [ERROR] failed to run custom build command for `published v0.1.0` - -Caused by: - process didn't exit successfully: `[ROOT]/foo/target/debug/build/published-[HASH]/build-script-build` ([EXIT_STATUS]: 101) - --- stdout - cargo::warning=foo - cargo::warning=bar - - --- stderr + | + = caused by: process didn't exit successfully: `[ROOT]/foo/target/debug/build/published-[HASH]/build-script-build` ([EXIT_STATUS]: 101) + --- stdout + cargo::warning=foo + cargo::warning=bar + + --- stderr + ... [..]dependency panicked[..] ... @@ -4770,14 +4762,14 @@ fn links_duplicates_with_cycle() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to select a version for `a`. - ... required by package `foo v0.5.0 ([ROOT]/foo)` -versions that meet the requirements `*` are: 0.5.0 - -package `a` links to the native library `a`, but it conflicts with a previous package which links to `a` as well: -package `foo v0.5.0 ([ROOT]/foo)` -Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the `links = "a"` value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links. - -failed to select a version for `a` which could resolve this conflict + ... required by package `foo v0.5.0 ([ROOT]/foo)` + versions that meet the requirements `*` are: 0.5.0 + + package `a` links to the native library `a`, but it conflicts with a previous package which links to `a` as well: + package `foo v0.5.0 ([ROOT]/foo)` + Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the `links = "a"` value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links. + + failed to select a version for `a` which could resolve this conflict "#]]) .run(); @@ -5196,9 +5188,31 @@ fn links_interrupted_can_restart() { p.cargo("build") .env("SOMEVAR", "1") .with_stderr_data(str![[r#" -... - Crash! -... +[COMPILING] bar v0.5.0 ([ROOT]/bar) +[WARNING] unused import: `std::env` + --> build.rs:2:17 + | +2 | use std::env; + | ^^^^^^^^ + | + = [NOTE] `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default + +[WARNING] `foo` (build script) generated 1 warning +[COMPILING] foo v0.5.0 ([ROOT]/foo) +[ERROR] failed to run custom build command for `foo v0.5.0 ([ROOT]/foo)` + | + = caused by: process didn't exit successfully: `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build` ([EXIT_STATUS]: 101) + --- stdout + cargo::metadata=rebuild-if-changed=build.rs + + --- stderr + + thread 'main' (3239627) panicked at build.rs:6:21: + Crash! + [NOTE] run with `RUST_BACKTRACE=1` environment variable to display a backtrace + +[WARNING] build failed, waiting for other jobs to finish... + "#]]) .with_status(101) .run(); @@ -5635,8 +5649,8 @@ fn wrong_output() { .with_stderr_data(str![[r#" [COMPILING] foo v0.0.1 ([ROOT]/foo) [ERROR] invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo::example` -Expected a line with `cargo::KEY=VALUE` with an `=` character, but none was found. -See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script for more information about build script outputs. + Expected a line with `cargo::KEY=VALUE` with an `=` character, but none was found. + See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script for more information about build script outputs. "#]]) .run(); @@ -5728,8 +5742,8 @@ fn test_invalid_old_syntax() { .with_stderr_data(str![[r#" [COMPILING] foo v0.0.1 ([ROOT]/foo) [ERROR] invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo:foo` -Expected a line with `cargo:KEY=VALUE` with an `=` character, but none was found. -See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script for more information about build script outputs. + Expected a line with `cargo:KEY=VALUE` with an `=` character, but none was found. + See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script for more information about build script outputs. "#]]) .run(); @@ -5755,8 +5769,8 @@ fn test_invalid_new_syntax() { .with_stderr_data(str![[r#" [COMPILING] foo v0.0.1 ([ROOT]/foo) [ERROR] invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo::metadata=foo` -Expected a line with `cargo::metadata=KEY=VALUE` with an `=` character, but none was found. -See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script for more information about build script outputs. + Expected a line with `cargo::metadata=KEY=VALUE` with an `=` character, but none was found. + See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script for more information about build script outputs. "#]]) .run(); @@ -5778,8 +5792,8 @@ See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the- .with_stderr_data(str![[r#" [COMPILING] foo v0.0.1 ([ROOT]/foo) [ERROR] invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo::foo=bar` -Unknown key: `foo`. -See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script for more information about build script outputs. + Unknown key: `foo`. + See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script for more information about build script outputs. "#]]) .run(); @@ -5816,8 +5830,8 @@ fn test_new_syntax_with_old_msrv() { .with_stderr_data(str![[r#" [COMPILING] foo v0.5.0 ([ROOT]/foo) [ERROR] the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, but the minimum supported Rust version of `foo v0.5.0 ([ROOT]/foo)` is 1.60.0. -Switch to the old `cargo:foo=bar` syntax instead of `cargo::metadata=foo=bar` (note the single colon). -See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script for more information about build script outputs. + Switch to the old `cargo:foo=bar` syntax instead of `cargo::metadata=foo=bar` (note the single colon). + See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script for more information about build script outputs. "#]]) .run(); @@ -5854,8 +5868,8 @@ fn test_new_syntax_with_old_msrv_and_reserved_prefix() { .with_stderr_data(str![[r#" [COMPILING] foo v0.5.0 ([ROOT]/foo) [ERROR] the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, but the minimum supported Rust version of `foo v0.5.0 ([ROOT]/foo)` is 1.60.0. -Switch to the old `cargo:rustc-check-cfg=cfg(foo)` syntax (note the single colon). -See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script for more information about build script outputs. + Switch to the old `cargo:rustc-check-cfg=cfg(foo)` syntax (note the single colon). + See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script for more information about build script outputs. "#]]) .run(); @@ -5892,7 +5906,7 @@ fn test_new_syntax_with_old_msrv_and_unknown_prefix() { .with_stderr_data(str![[r#" [COMPILING] foo v0.5.0 ([ROOT]/foo) [ERROR] the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, but the minimum supported Rust version of `foo v0.5.0 ([ROOT]/foo)` is 1.60.0. -See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script for more information about build script outputs. + See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script for more information about build script outputs. "#]]) .run(); diff --git a/tests/testsuite/build_script_env.rs b/tests/testsuite/build_script_env.rs index 15d3a671535..618f0db968a 100644 --- a/tests/testsuite/build_script_env.rs +++ b/tests/testsuite/build_script_env.rs @@ -130,8 +130,8 @@ fn rustc_bootstrap() { .with_stderr_data(str![[r#" [COMPILING] has-dashes v0.0.1 ([ROOT]/foo) [ERROR] Cannot set `RUSTC_BOOTSTRAP=1` from build script of `has-dashes v0.0.1 ([ROOT]/foo)`. -[NOTE] Crates cannot set `RUSTC_BOOTSTRAP` themselves, as doing so would subvert the stability guarantees of Rust for your project. -[HELP] If you're sure you want to do this in your project, set the environment variable `RUSTC_BOOTSTRAP=has_dashes` before running cargo instead. + [NOTE] Crates cannot set `RUSTC_BOOTSTRAP` themselves, as doing so would subvert the stability guarantees of Rust for your project. + [HELP] If you're sure you want to do this in your project, set the environment variable `RUSTC_BOOTSTRAP=has_dashes` before running cargo instead. "#]]) .with_status(101) @@ -165,8 +165,8 @@ fn rustc_bootstrap() { .env("RUSTC_BOOTSTRAP", "bar") .with_stderr_data(str![[r#" [ERROR] Cannot set `RUSTC_BOOTSTRAP=1` from build script of `has-dashes v0.0.1 ([ROOT]/foo)`. -[NOTE] Crates cannot set `RUSTC_BOOTSTRAP` themselves, as doing so would subvert the stability guarantees of Rust for your project. -[HELP] If you're sure you want to do this in your project, set the environment variable `RUSTC_BOOTSTRAP=has_dashes` before running cargo instead. + [NOTE] Crates cannot set `RUSTC_BOOTSTRAP` themselves, as doing so would subvert the stability guarantees of Rust for your project. + [HELP] If you're sure you want to do this in your project, set the environment variable `RUSTC_BOOTSTRAP=has_dashes` before running cargo instead. "#]]) .with_status(101) @@ -200,8 +200,8 @@ fn rustc_bootstrap() { .env("RUSTC_BOOTSTRAP", "foo") .with_stderr_data(str![[r#" [ERROR] Cannot set `RUSTC_BOOTSTRAP=1` from build script of `foo v0.0.1 ([ROOT]/foo)`. -[NOTE] Crates cannot set `RUSTC_BOOTSTRAP` themselves, as doing so would subvert the stability guarantees of Rust for your project. -[HELP] If you're sure you want to do this in your project, set the environment variable `RUSTC_BOOTSTRAP=1` before running cargo instead. + [NOTE] Crates cannot set `RUSTC_BOOTSTRAP` themselves, as doing so would subvert the stability guarantees of Rust for your project. + [HELP] If you're sure you want to do this in your project, set the environment variable `RUSTC_BOOTSTRAP=1` before running cargo instead. "#]]) .with_status(101) diff --git a/tests/testsuite/build_script_extra_link_arg.rs b/tests/testsuite/build_script_extra_link_arg.rs index 5273d1a081f..74bf3002538 100644 --- a/tests/testsuite/build_script_extra_link_arg.rs +++ b/tests/testsuite/build_script_extra_link_arg.rs @@ -142,7 +142,7 @@ fn link_arg_missing_target() { .with_stderr_data(str![[r#" [COMPILING] foo v0.0.1 ([ROOT]/foo) [ERROR] invalid instruction `cargo::rustc-link-arg-bins` from build script of `foo v0.0.1 ([ROOT]/foo)` -The package foo v0.0.1 ([ROOT]/foo) does not have a bin target. + The package foo v0.0.1 ([ROOT]/foo) does not have a bin target. "#]]) .run(); @@ -157,7 +157,7 @@ The package foo v0.0.1 ([ROOT]/foo) does not have a bin target. .with_stderr_data(str![[r#" [COMPILING] foo v0.0.1 ([ROOT]/foo) [ERROR] invalid instruction `cargo::rustc-link-arg-bin` from build script of `foo v0.0.1 ([ROOT]/foo)` -The package foo v0.0.1 ([ROOT]/foo) does not have a bin target with the name `abc`. + The package foo v0.0.1 ([ROOT]/foo) does not have a bin target with the name `abc`. "#]]) .run(); @@ -172,7 +172,7 @@ The package foo v0.0.1 ([ROOT]/foo) does not have a bin target with the name `ab .with_stderr_data(str![[r#" [COMPILING] foo v0.0.1 ([ROOT]/foo) [ERROR] invalid instruction `cargo::rustc-link-arg-bin=abc` from build script of `foo v0.0.1 ([ROOT]/foo)` -The instruction should have the form cargo::rustc-link-arg-bin=BIN=ARG + The instruction should have the form cargo::rustc-link-arg-bin=BIN=ARG "#]]) .run(); diff --git a/tests/testsuite/build_scripts_multiple.rs b/tests/testsuite/build_scripts_multiple.rs index 8e7457fb954..a89bf5d2dd3 100644 --- a/tests/testsuite/build_scripts_multiple.rs +++ b/tests/testsuite/build_scripts_multiple.rs @@ -30,13 +30,13 @@ fn build_without_feature_enabled_aborts_with_error() { .with_status(101) .with_stderr_data(str![[r#" [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - feature `multiple-build-scripts` is required - - The package requires the Cargo feature called `multiple-build-scripts`, but that feature is not stabilized in this version of Cargo ([..]). - Consider adding `cargo-features = ["multiple-build-scripts"]` to the top of Cargo.toml (above the [package] table) to tell Cargo you are opting in to use this unstable feature. - See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#multiple-build-scripts for more information about the status of this feature. + | + = caused by: feature `multiple-build-scripts` is required + + The package requires the Cargo feature called `multiple-build-scripts`, but that feature is not stabilized in this version of Cargo (1.91.0 (3eafc35f1 2025-09-03)). + Consider adding `cargo-features = ["multiple-build-scripts"]` to the top of Cargo.toml (above the [package] table) to tell Cargo you are opting in to use this unstable feature. + See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#multiple-build-scripts for more information about the status of this feature. + "#]]) .run(); @@ -439,10 +439,9 @@ fn custom_build_script_first_index_script_failed() { [COMPILING] foo v0.1.0 ([ROOT]/foo) ... [ERROR] failed to run custom build command for `foo v0.1.0 ([ROOT]/foo)` + | + = caused by: process didn't exit successfully: `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build1` ([EXIT_STATUS]: 101) -Caused by: - process didn't exit successfully: `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build1` ([EXIT_STATUS]: 101) -... "#]]) .run(); } @@ -477,9 +476,9 @@ fn custom_build_script_second_index_script_failed() { [COMPILING] foo v0.1.0 ([ROOT]/foo) ... [ERROR] failed to run custom build command for `foo v0.1.0 ([ROOT]/foo)` - -Caused by: - process didn't exit successfully: `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build2` ([EXIT_STATUS]: 101) + | + = caused by: process didn't exit successfully: `[ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build2` ([EXIT_STATUS]: 101) +[WARNING] build failed, waiting for other jobs to finish... ... "#]]) .run(); diff --git a/tests/testsuite/cargo_add/add_no_vendored_package_with_vendor/stderr.term.svg b/tests/testsuite/cargo_add/add_no_vendored_package_with_vendor/stderr.term.svg index 13189fd5cf6..d2f879cba68 100644 --- a/tests/testsuite/cargo_add/add_no_vendored_package_with_vendor/stderr.term.svg +++ b/tests/testsuite/cargo_add/add_no_vendored_package_with_vendor/stderr.term.svg @@ -2,7 +2,7 @@