Skip to content

fix(compiler): Clarify Finished message #13422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/cargo/core/compiler/job_queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,9 +806,13 @@ impl<'cfg> DrainState<'cfg> {
// `display_error` inside `handle_error`.
Some(anyhow::Error::new(AlreadyPrintedError::new(error)))
} else if self.queue.is_empty() && self.pending_queue.is_empty() {
let profile_link = cx.bcx.config.shell().err_hyperlink(
"https://doc.rust-lang.org/cargo/reference/profiles.html#default-profiles",
);
let message = format!(
"{} [{}] target(s) in {}",
profile_name, opt_type, time_elapsed
"{}`{profile_name}` profile [{opt_type}]{} target(s) in {time_elapsed}",
profile_link.open(),
profile_link.close()
);
if !cx.bcx.build_config.build_plan {
// It doesn't really matter if this fails.
Expand Down
4 changes: 2 additions & 2 deletions tests/build-std/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ fn basic() {
// There have been multiple bugs where every build triggers and update.
.with_stderr(
"[COMPILING] foo v0.0.1 [..]\n\
[FINISHED] dev [..]",
[FINISHED] `dev` profile [..]",
)
.run();
p.cargo("run").build_std().target_host().run();
Expand Down Expand Up @@ -262,7 +262,7 @@ fn remap_path_scope() {
.with_status(101)
.with_stderr_contains(
"\
[FINISHED] release [optimized + debuginfo] [..]
[FINISHED] `release` profile [optimized + debuginfo] [..]
[RUNNING] [..]
[..]thread '[..]' panicked at [..]src/main.rs:3:[..]",
)
Expand Down
20 changes: 10 additions & 10 deletions tests/testsuite/alt_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn depend_on_alt_registry() {
[DOWNLOADED] bar v0.0.1 (registry `alternative`)
[CHECKING] bar v0.0.1 (registry `alternative`)
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s
",
)
.run();
Expand All @@ -49,7 +49,7 @@ fn depend_on_alt_registry() {
"\
[CHECKING] bar v0.0.1 (registry `alternative`)
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s
",
)
.run();
Expand Down Expand Up @@ -91,7 +91,7 @@ fn depend_on_alt_registry_depends_on_same_registry_no_index() {
[CHECKING] baz v0.0.1 (registry `alternative`)
[CHECKING] bar v0.0.1 (registry `alternative`)
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s
",
)
.run();
Expand Down Expand Up @@ -133,7 +133,7 @@ fn depend_on_alt_registry_depends_on_same_registry() {
[CHECKING] baz v0.0.1 (registry `alternative`)
[CHECKING] bar v0.0.1 (registry `alternative`)
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s
",
)
.run();
Expand Down Expand Up @@ -176,7 +176,7 @@ fn depend_on_alt_registry_depends_on_crates_io() {
[CHECKING] baz v0.0.1
[CHECKING] bar v0.0.1 (registry `alternative`)
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s
",
)
.run();
Expand Down Expand Up @@ -210,7 +210,7 @@ fn registry_and_path_dep_works() {
"\
[CHECKING] bar v0.0.1 ([CWD]/bar)
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s
",
)
.run();
Expand Down Expand Up @@ -413,7 +413,7 @@ fn alt_registry_and_crates_io_deps() {
[CHECKING] alt_reg_dep v0.1.0 (registry `alternative`)
[CHECKING] crates_io_dep v0.0.1
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s
",
)
.run();
Expand Down Expand Up @@ -683,7 +683,7 @@ fn patch_alt_reg() {
[UPDATING] `alternative` index
[CHECKING] bar v0.1.0 ([CWD]/bar)
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
",
)
.run();
Expand Down Expand Up @@ -775,7 +775,7 @@ fn no_api() {
[DOWNLOADED] bar v0.0.1 (registry `alternative`)
[CHECKING] bar v0.0.1 (registry `alternative`)
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s
",
)
.run();
Expand Down Expand Up @@ -1334,7 +1334,7 @@ fn registries_index_relative_url() {
[DOWNLOADED] bar v0.0.1 (registry `relative`)
[CHECKING] bar v0.0.1 (registry `relative`)
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s
",
)
.run();
Expand Down
50 changes: 27 additions & 23 deletions tests/testsuite/artifact_dep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ fn features_are_unified_among_lib_and_bin_dep_of_same_target() {
[COMPILING] d2 v0.0.1 ([CWD]/d2)
[COMPILING] d1 v0.0.1 ([CWD]/d1)
[COMPILING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
",
)
.run();
Expand Down Expand Up @@ -568,7 +568,9 @@ fn build_script_with_bin_artifacts() {
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr_contains("[COMPILING] foo [..]")
.with_stderr_contains("[COMPILING] bar v0.5.0 ([CWD]/bar)")
.with_stderr_contains("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]")
.with_stderr_contains(
"[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]",
)
.run();

let build_script_output = build_script_output_string(&p, "foo");
Expand Down Expand Up @@ -752,7 +754,7 @@ fn build_script_with_selected_dashed_bin_artifact_and_lib_true() {
"\
[COMPILING] bar-baz v0.5.0 ([CWD]/bar)
[COMPILING] foo [..]
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]",
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]",
)
.run();

Expand Down Expand Up @@ -849,7 +851,7 @@ fn lib_with_selected_dashed_bin_artifact_and_lib_true() {
"\
[COMPILING] bar-baz v0.5.0 ([CWD]/bar)
[COMPILING] foo [..]
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]",
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]",
)
.run();

Expand Down Expand Up @@ -895,7 +897,9 @@ fn allow_artifact_and_no_artifact_dep_to_same_package_within_different_dep_categ
p.cargo("test -Z bindeps")
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr_contains("[COMPILING] bar v0.5.0 ([CWD]/bar)")
.with_stderr_contains("[FINISHED] test [unoptimized + debuginfo] target(s) in [..]")
.with_stderr_contains(
"[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [..]",
)
.run();
}

Expand Down Expand Up @@ -1229,7 +1233,7 @@ fn no_cross_doctests_works_with_artifacts() {
"\
[COMPILING] bar v0.5.0 ([CWD]/bar)
[COMPILING] foo v0.0.1 ([CWD])
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [..]
[RUNNING] [..] (target/{triple}/debug/deps/foo-[..][EXE])
[DOCTEST] foo
",
Expand All @@ -1251,7 +1255,7 @@ fn no_cross_doctests_works_with_artifacts() {
[RUNNING] `rustc --crate-name bar bar/src/main.rs [..]--target {triple} [..]
[COMPILING] foo v0.0.1 ([CWD])
[RUNNING] `rustc --crate-name foo [..]
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]",
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [..]",
triple = target
))
.run();
Expand All @@ -1268,7 +1272,7 @@ fn no_cross_doctests_works_with_artifacts() {
"[FRESH] bar v0.5.0 ([CWD]/bar)
[COMPILING] foo v0.0.1 ([CWD])
[RUNNING] `rustc --crate-name foo [..]--test[..]
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `[CWD]/target/{triple}/debug/deps/foo-[..][EXE]`",
triple = target
))
Expand Down Expand Up @@ -1702,7 +1706,7 @@ fn allow_artifact_and_non_artifact_dependency_to_same_crate_if_these_are_not_the
"\
[COMPILING] bar [..]
[COMPILING] foo [..]
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
",
)
.run();
Expand Down Expand Up @@ -1737,7 +1741,7 @@ fn prevent_no_lib_warning_with_artifact_dependencies() {
"\
[COMPILING] bar v0.5.0 ([CWD]/bar)\n\
[CHECKING] foo v0.0.0 ([CWD])\n\
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]",
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]",
)
.run();
}
Expand Down Expand Up @@ -1771,7 +1775,7 @@ fn show_no_lib_warning_with_artifact_dependencies_that_have_no_lib_but_lib_true(
.with_stderr_contains("[WARNING] foo v0.0.0 ([CWD]) ignoring invalid dependency `bar` which is missing a lib target")
.with_stderr_contains("[COMPILING] bar v0.5.0 ([CWD]/bar)")
.with_stderr_contains("[CHECKING] foo [..]")
.with_stderr_contains("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]")
.with_stderr_contains("[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]")
.run();
}

Expand Down Expand Up @@ -1977,7 +1981,7 @@ fn env_vars_and_build_products_for_various_build_targets() {
"\
[COMPILING] bar [..]
[COMPILING] foo [..]
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [..]
[RUNNING] unittests [..]
[RUNNING] tests/main.rs [..]
[DOCTEST] foo
Expand Down Expand Up @@ -2151,7 +2155,7 @@ fn doc_lib_true() {
[COMPILING] bar v0.0.1 ([CWD]/bar)
[DOCUMENTING] bar v0.0.1 ([CWD]/bar)
[DOCUMENTING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
[GENERATED] [CWD]/target/doc/foo/index.html
",
)
Expand Down Expand Up @@ -2230,7 +2234,7 @@ fn rustdoc_works_on_libs_with_artifacts_and_lib_false() {
"\
[COMPILING] bar v0.5.0 ([CWD]/bar)
[DOCUMENTING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
[GENERATED] [CWD]/target/doc/foo/index.html
",
)
Expand Down Expand Up @@ -2433,7 +2437,7 @@ fn calc_bin_artifact_fingerprint() {
"\
[COMPILING] bar v0.5.0 ([CWD]/bar)
[CHECKING] foo v0.1.0 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
",
)
.run();
Expand All @@ -2450,7 +2454,7 @@ fn calc_bin_artifact_fingerprint() {
[DIRTY] foo v0.1.0 ([CWD]): the dependency bar was rebuilt
[CHECKING] foo v0.1.0 ([CWD])
[RUNNING] `rustc --crate-name foo [..]`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
",
)
.run();
Expand All @@ -2462,7 +2466,7 @@ fn calc_bin_artifact_fingerprint() {
"\
[FRESH] bar v0.5.0 ([CWD]/bar)
[FRESH] foo v0.1.0 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
",
)
.run();
Expand Down Expand Up @@ -2516,7 +2520,7 @@ fn with_target_and_optional() {
[RUNNING] `rustc --crate-name d1 [..]--crate-type bin[..]
[CHECKING] foo v0.0.1 [..]
[RUNNING] `rustc --crate-name foo [..]--cfg[..]d1[..]
[FINISHED] dev [..]
[FINISHED] `dev` profile [..]
",
)
.run();
Expand Down Expand Up @@ -2567,7 +2571,7 @@ fn with_assumed_host_target_and_optional_build_dep() {
[RUNNING] `rustc --crate-name d1 [..]--crate-type bin[..]
[RUNNING] `[CWD]/target/debug/build/foo-[..]/build-script-build`
[RUNNING] `rustc --crate-name foo [..]--cfg[..]d1[..]
[FINISHED] dev [..]
[FINISHED] `dev` profile [..]
",
)
.run();
Expand Down Expand Up @@ -2690,7 +2694,7 @@ fn decouple_same_target_transitive_dep_from_artifact_dep() {
[COMPILING] a v0.1.0 ([CWD]/a)
[COMPILING] bar v0.1.0 ([CWD]/bar)
[COMPILING] foo v0.1.0 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
",
)
.run();
Expand Down Expand Up @@ -2790,7 +2794,7 @@ fn decouple_same_target_transitive_dep_from_artifact_dep_lib() {
[COMPILING] a v0.1.0 ([CWD]/a)
[COMPILING] bar v0.1.0 ([CWD]/bar)
[COMPILING] foo v0.1.0 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
",
)
.run();
Expand Down Expand Up @@ -2915,7 +2919,7 @@ fn decouple_same_target_transitive_dep_from_artifact_dep_and_proc_macro() {
[COMPILING] c v0.1.0 ([CWD]/c)
[COMPILING] bar v0.1.0 ([CWD]/bar)
[COMPILING] foo v0.1.0 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
",
)
.run();
Expand Down Expand Up @@ -2974,7 +2978,7 @@ fn same_target_artifact_dep_sharing() {
[COMPILING] a v0.1.0 ([CWD]/a)
[COMPILING] bar v0.1.0 ([CWD]/bar)
[COMPILING] foo v0.1.0 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
",
)
.run();
Expand Down
8 changes: 4 additions & 4 deletions tests/testsuite/bad_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ fn unused_keys() {
"\
warning: unused manifest key: target.foo.bar
[CHECKING] foo v0.1.0 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
",
)
.run();
Expand All @@ -698,7 +698,7 @@ warning: unused manifest key: target.foo.bar
"\
warning: unused manifest key: package.bulid
[CHECKING] foo [..]
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
",
)
.run();
Expand All @@ -725,7 +725,7 @@ warning: unused manifest key: package.bulid
"\
warning: unused manifest key: lib.build
[CHECKING] foo [..]
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
",
)
.run();
Expand All @@ -750,7 +750,7 @@ fn unused_keys_in_virtual_manifest() {
"\
[WARNING] [..]/foo/Cargo.toml: unused manifest key: workspace.bulid
[CHECKING] bar [..]
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
",
)
.run();
Expand Down
Loading