Skip to content

Commit 6283793

Browse files
committed
Auto merge of #13422 - epage:profile, r=weihanglo
fix(compiler): Clarify Finished message ### What does this PR try to resolve? As highlighted on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/cargo.20build.20default.20profile/near/418316528), many users think "Rust is slow" because of the `dev` profile. While a perfect solution is still being worked out, this attempts what will hopefully be smaller, incremental step that hopefully maintains balance of the different needs. We are changing the message from: ``` Finished dev [unoptimized + debuginfo] target(s) in [..]s ``` to ``` Finished `dev` profile [unoptimized + debuginfo] target(s) in [..]s ``` where `dev profile` is a link to [the Cargo book](https://doc.rust-lang.org/cargo/reference/profiles.html#profiles). The intent is - Clarify what `dev` even means - Add `profile` to give it context - Quote it to highlight this is something mutable - Make the profile content stand out on hover by being a link - Help people learn more by following the link For now, this leaves the profile description alone. ### How should we test and review this PR? ### Additional information
2 parents af08da6 + 69f38a0 commit 6283793

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+793
-781
lines changed

src/cargo/core/compiler/job_queue/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -806,9 +806,13 @@ impl<'cfg> DrainState<'cfg> {
806806
// `display_error` inside `handle_error`.
807807
Some(anyhow::Error::new(AlreadyPrintedError::new(error)))
808808
} else if self.queue.is_empty() && self.pending_queue.is_empty() {
809+
let profile_link = cx.bcx.config.shell().err_hyperlink(
810+
"https://doc.rust-lang.org/cargo/reference/profiles.html#default-profiles",
811+
);
809812
let message = format!(
810-
"{} [{}] target(s) in {}",
811-
profile_name, opt_type, time_elapsed
813+
"{}`{profile_name}` profile [{opt_type}]{} target(s) in {time_elapsed}",
814+
profile_link.open(),
815+
profile_link.close()
812816
);
813817
if !cx.bcx.build_config.build_plan {
814818
// It doesn't really matter if this fails.

tests/build-std/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ fn basic() {
114114
// There have been multiple bugs where every build triggers and update.
115115
.with_stderr(
116116
"[COMPILING] foo v0.0.1 [..]\n\
117-
[FINISHED] dev [..]",
117+
[FINISHED] `dev` profile [..]",
118118
)
119119
.run();
120120
p.cargo("run").build_std().target_host().run();
@@ -262,7 +262,7 @@ fn remap_path_scope() {
262262
.with_status(101)
263263
.with_stderr_contains(
264264
"\
265-
[FINISHED] release [optimized + debuginfo] [..]
265+
[FINISHED] `release` profile [optimized + debuginfo] [..]
266266
[RUNNING] [..]
267267
[..]thread '[..]' panicked at [..]src/main.rs:3:[..]",
268268
)

tests/testsuite/alt_registry.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn depend_on_alt_registry() {
3636
[DOWNLOADED] bar v0.0.1 (registry `alternative`)
3737
[CHECKING] bar v0.0.1 (registry `alternative`)
3838
[CHECKING] foo v0.0.1 ([CWD])
39-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
39+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s
4040
",
4141
)
4242
.run();
@@ -49,7 +49,7 @@ fn depend_on_alt_registry() {
4949
"\
5050
[CHECKING] bar v0.0.1 (registry `alternative`)
5151
[CHECKING] foo v0.0.1 ([CWD])
52-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
52+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s
5353
",
5454
)
5555
.run();
@@ -91,7 +91,7 @@ fn depend_on_alt_registry_depends_on_same_registry_no_index() {
9191
[CHECKING] baz v0.0.1 (registry `alternative`)
9292
[CHECKING] bar v0.0.1 (registry `alternative`)
9393
[CHECKING] foo v0.0.1 ([CWD])
94-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
94+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s
9595
",
9696
)
9797
.run();
@@ -133,7 +133,7 @@ fn depend_on_alt_registry_depends_on_same_registry() {
133133
[CHECKING] baz v0.0.1 (registry `alternative`)
134134
[CHECKING] bar v0.0.1 (registry `alternative`)
135135
[CHECKING] foo v0.0.1 ([CWD])
136-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
136+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s
137137
",
138138
)
139139
.run();
@@ -176,7 +176,7 @@ fn depend_on_alt_registry_depends_on_crates_io() {
176176
[CHECKING] baz v0.0.1
177177
[CHECKING] bar v0.0.1 (registry `alternative`)
178178
[CHECKING] foo v0.0.1 ([CWD])
179-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
179+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s
180180
",
181181
)
182182
.run();
@@ -210,7 +210,7 @@ fn registry_and_path_dep_works() {
210210
"\
211211
[CHECKING] bar v0.0.1 ([CWD]/bar)
212212
[CHECKING] foo v0.0.1 ([CWD])
213-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
213+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s
214214
",
215215
)
216216
.run();
@@ -413,7 +413,7 @@ fn alt_registry_and_crates_io_deps() {
413413
[CHECKING] alt_reg_dep v0.1.0 (registry `alternative`)
414414
[CHECKING] crates_io_dep v0.0.1
415415
[CHECKING] foo v0.0.1 ([CWD])
416-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
416+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s
417417
",
418418
)
419419
.run();
@@ -683,7 +683,7 @@ fn patch_alt_reg() {
683683
[UPDATING] `alternative` index
684684
[CHECKING] bar v0.1.0 ([CWD]/bar)
685685
[CHECKING] foo v0.0.1 ([CWD])
686-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
686+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
687687
",
688688
)
689689
.run();
@@ -775,7 +775,7 @@ fn no_api() {
775775
[DOWNLOADED] bar v0.0.1 (registry `alternative`)
776776
[CHECKING] bar v0.0.1 (registry `alternative`)
777777
[CHECKING] foo v0.0.1 ([CWD])
778-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
778+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s
779779
",
780780
)
781781
.run();
@@ -1334,7 +1334,7 @@ fn registries_index_relative_url() {
13341334
[DOWNLOADED] bar v0.0.1 (registry `relative`)
13351335
[CHECKING] bar v0.0.1 (registry `relative`)
13361336
[CHECKING] foo v0.0.1 ([CWD])
1337-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
1337+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]s
13381338
",
13391339
)
13401340
.run();

tests/testsuite/artifact_dep.rs

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ fn features_are_unified_among_lib_and_bin_dep_of_same_target() {
316316
[COMPILING] d2 v0.0.1 ([CWD]/d2)
317317
[COMPILING] d1 v0.0.1 ([CWD]/d1)
318318
[COMPILING] foo v0.0.1 ([CWD])
319-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
319+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
320320
",
321321
)
322322
.run();
@@ -568,7 +568,9 @@ fn build_script_with_bin_artifacts() {
568568
.masquerade_as_nightly_cargo(&["bindeps"])
569569
.with_stderr_contains("[COMPILING] foo [..]")
570570
.with_stderr_contains("[COMPILING] bar v0.5.0 ([CWD]/bar)")
571-
.with_stderr_contains("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]")
571+
.with_stderr_contains(
572+
"[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]",
573+
)
572574
.run();
573575

574576
let build_script_output = build_script_output_string(&p, "foo");
@@ -752,7 +754,7 @@ fn build_script_with_selected_dashed_bin_artifact_and_lib_true() {
752754
"\
753755
[COMPILING] bar-baz v0.5.0 ([CWD]/bar)
754756
[COMPILING] foo [..]
755-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]",
757+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]",
756758
)
757759
.run();
758760

@@ -849,7 +851,7 @@ fn lib_with_selected_dashed_bin_artifact_and_lib_true() {
849851
"\
850852
[COMPILING] bar-baz v0.5.0 ([CWD]/bar)
851853
[COMPILING] foo [..]
852-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]",
854+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]",
853855
)
854856
.run();
855857

@@ -895,7 +897,9 @@ fn allow_artifact_and_no_artifact_dep_to_same_package_within_different_dep_categ
895897
p.cargo("test -Z bindeps")
896898
.masquerade_as_nightly_cargo(&["bindeps"])
897899
.with_stderr_contains("[COMPILING] bar v0.5.0 ([CWD]/bar)")
898-
.with_stderr_contains("[FINISHED] test [unoptimized + debuginfo] target(s) in [..]")
900+
.with_stderr_contains(
901+
"[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [..]",
902+
)
899903
.run();
900904
}
901905

@@ -1229,7 +1233,7 @@ fn no_cross_doctests_works_with_artifacts() {
12291233
"\
12301234
[COMPILING] bar v0.5.0 ([CWD]/bar)
12311235
[COMPILING] foo v0.0.1 ([CWD])
1232-
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]
1236+
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [..]
12331237
[RUNNING] [..] (target/{triple}/debug/deps/foo-[..][EXE])
12341238
[DOCTEST] foo
12351239
",
@@ -1251,7 +1255,7 @@ fn no_cross_doctests_works_with_artifacts() {
12511255
[RUNNING] `rustc --crate-name bar bar/src/main.rs [..]--target {triple} [..]
12521256
[COMPILING] foo v0.0.1 ([CWD])
12531257
[RUNNING] `rustc --crate-name foo [..]
1254-
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]",
1258+
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [..]",
12551259
triple = target
12561260
))
12571261
.run();
@@ -1268,7 +1272,7 @@ fn no_cross_doctests_works_with_artifacts() {
12681272
"[FRESH] bar v0.5.0 ([CWD]/bar)
12691273
[COMPILING] foo v0.0.1 ([CWD])
12701274
[RUNNING] `rustc --crate-name foo [..]--test[..]
1271-
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]
1275+
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [..]
12721276
[RUNNING] `[CWD]/target/{triple}/debug/deps/foo-[..][EXE]`",
12731277
triple = target
12741278
))
@@ -1702,7 +1706,7 @@ fn allow_artifact_and_non_artifact_dependency_to_same_crate_if_these_are_not_the
17021706
"\
17031707
[COMPILING] bar [..]
17041708
[COMPILING] foo [..]
1705-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
1709+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
17061710
",
17071711
)
17081712
.run();
@@ -1737,7 +1741,7 @@ fn prevent_no_lib_warning_with_artifact_dependencies() {
17371741
"\
17381742
[COMPILING] bar v0.5.0 ([CWD]/bar)\n\
17391743
[CHECKING] foo v0.0.0 ([CWD])\n\
1740-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]",
1744+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]",
17411745
)
17421746
.run();
17431747
}
@@ -1771,7 +1775,7 @@ fn show_no_lib_warning_with_artifact_dependencies_that_have_no_lib_but_lib_true(
17711775
.with_stderr_contains("[WARNING] foo v0.0.0 ([CWD]) ignoring invalid dependency `bar` which is missing a lib target")
17721776
.with_stderr_contains("[COMPILING] bar v0.5.0 ([CWD]/bar)")
17731777
.with_stderr_contains("[CHECKING] foo [..]")
1774-
.with_stderr_contains("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]")
1778+
.with_stderr_contains("[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]")
17751779
.run();
17761780
}
17771781

@@ -1977,7 +1981,7 @@ fn env_vars_and_build_products_for_various_build_targets() {
19771981
"\
19781982
[COMPILING] bar [..]
19791983
[COMPILING] foo [..]
1980-
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]
1984+
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [..]
19811985
[RUNNING] unittests [..]
19821986
[RUNNING] tests/main.rs [..]
19831987
[DOCTEST] foo
@@ -2151,7 +2155,7 @@ fn doc_lib_true() {
21512155
[COMPILING] bar v0.0.1 ([CWD]/bar)
21522156
[DOCUMENTING] bar v0.0.1 ([CWD]/bar)
21532157
[DOCUMENTING] foo v0.0.1 ([CWD])
2154-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
2158+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
21552159
[GENERATED] [CWD]/target/doc/foo/index.html
21562160
",
21572161
)
@@ -2230,7 +2234,7 @@ fn rustdoc_works_on_libs_with_artifacts_and_lib_false() {
22302234
"\
22312235
[COMPILING] bar v0.5.0 ([CWD]/bar)
22322236
[DOCUMENTING] foo v0.0.1 ([CWD])
2233-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
2237+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
22342238
[GENERATED] [CWD]/target/doc/foo/index.html
22352239
",
22362240
)
@@ -2433,7 +2437,7 @@ fn calc_bin_artifact_fingerprint() {
24332437
"\
24342438
[COMPILING] bar v0.5.0 ([CWD]/bar)
24352439
[CHECKING] foo v0.1.0 ([CWD])
2436-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
2440+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
24372441
",
24382442
)
24392443
.run();
@@ -2450,7 +2454,7 @@ fn calc_bin_artifact_fingerprint() {
24502454
[DIRTY] foo v0.1.0 ([CWD]): the dependency bar was rebuilt
24512455
[CHECKING] foo v0.1.0 ([CWD])
24522456
[RUNNING] `rustc --crate-name foo [..]`
2453-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
2457+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
24542458
",
24552459
)
24562460
.run();
@@ -2462,7 +2466,7 @@ fn calc_bin_artifact_fingerprint() {
24622466
"\
24632467
[FRESH] bar v0.5.0 ([CWD]/bar)
24642468
[FRESH] foo v0.1.0 ([CWD])
2465-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
2469+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
24662470
",
24672471
)
24682472
.run();
@@ -2516,7 +2520,7 @@ fn with_target_and_optional() {
25162520
[RUNNING] `rustc --crate-name d1 [..]--crate-type bin[..]
25172521
[CHECKING] foo v0.0.1 [..]
25182522
[RUNNING] `rustc --crate-name foo [..]--cfg[..]d1[..]
2519-
[FINISHED] dev [..]
2523+
[FINISHED] `dev` profile [..]
25202524
",
25212525
)
25222526
.run();
@@ -2567,7 +2571,7 @@ fn with_assumed_host_target_and_optional_build_dep() {
25672571
[RUNNING] `rustc --crate-name d1 [..]--crate-type bin[..]
25682572
[RUNNING] `[CWD]/target/debug/build/foo-[..]/build-script-build`
25692573
[RUNNING] `rustc --crate-name foo [..]--cfg[..]d1[..]
2570-
[FINISHED] dev [..]
2574+
[FINISHED] `dev` profile [..]
25712575
",
25722576
)
25732577
.run();
@@ -2690,7 +2694,7 @@ fn decouple_same_target_transitive_dep_from_artifact_dep() {
26902694
[COMPILING] a v0.1.0 ([CWD]/a)
26912695
[COMPILING] bar v0.1.0 ([CWD]/bar)
26922696
[COMPILING] foo v0.1.0 ([CWD])
2693-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
2697+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
26942698
",
26952699
)
26962700
.run();
@@ -2790,7 +2794,7 @@ fn decouple_same_target_transitive_dep_from_artifact_dep_lib() {
27902794
[COMPILING] a v0.1.0 ([CWD]/a)
27912795
[COMPILING] bar v0.1.0 ([CWD]/bar)
27922796
[COMPILING] foo v0.1.0 ([CWD])
2793-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
2797+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
27942798
",
27952799
)
27962800
.run();
@@ -2915,7 +2919,7 @@ fn decouple_same_target_transitive_dep_from_artifact_dep_and_proc_macro() {
29152919
[COMPILING] c v0.1.0 ([CWD]/c)
29162920
[COMPILING] bar v0.1.0 ([CWD]/bar)
29172921
[COMPILING] foo v0.1.0 ([CWD])
2918-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
2922+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
29192923
",
29202924
)
29212925
.run();
@@ -2974,7 +2978,7 @@ fn same_target_artifact_dep_sharing() {
29742978
[COMPILING] a v0.1.0 ([CWD]/a)
29752979
[COMPILING] bar v0.1.0 ([CWD]/bar)
29762980
[COMPILING] foo v0.1.0 ([CWD])
2977-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
2981+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
29782982
",
29792983
)
29802984
.run();

tests/testsuite/bad_config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ fn unused_keys() {
674674
"\
675675
warning: unused manifest key: target.foo.bar
676676
[CHECKING] foo v0.1.0 ([CWD])
677-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
677+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
678678
",
679679
)
680680
.run();
@@ -698,7 +698,7 @@ warning: unused manifest key: target.foo.bar
698698
"\
699699
warning: unused manifest key: package.bulid
700700
[CHECKING] foo [..]
701-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
701+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
702702
",
703703
)
704704
.run();
@@ -725,7 +725,7 @@ warning: unused manifest key: package.bulid
725725
"\
726726
warning: unused manifest key: lib.build
727727
[CHECKING] foo [..]
728-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
728+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
729729
",
730730
)
731731
.run();
@@ -750,7 +750,7 @@ fn unused_keys_in_virtual_manifest() {
750750
"\
751751
[WARNING] [..]/foo/Cargo.toml: unused manifest key: workspace.bulid
752752
[CHECKING] bar [..]
753-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
753+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
754754
",
755755
)
756756
.run();

0 commit comments

Comments
 (0)