Skip to content

Commit c8c849e

Browse files
committed
Use more consistent progress messages in bootstrap
Before: ``` Testing ["rustc_interface"] stage0 (aarch64-unknown-linux-gnu -> aarch64-unknown-linux-gnu) ``` After: ``` Testing {rustc_interface} stage0 (aarch64-unknown-linux-gnu -> aarch64-unknown-linux-gnu) ``` Note there is a slight consistency between `build` and `test`: The former doesn't print "compiler artifacts". It would be annoying to fix and doesn't hurt anything, so I left it be. ``` ; x t rustc_interface --stage 0 --dry-run Testing {rustc_interface} stage0 (aarch64-unknown-linux-gnu -> aarch64-unknown-linux-gnu) ; x b rustc_interface --stage 0 --dry-run Building {rustc_interface} stage0 compiler artifacts (aarch64-unknown-linux-gnu -> aarch64-unknown-linux-gnu) ```
1 parent cbede85 commit c8c849e

File tree

6 files changed

+40
-24
lines changed

6 files changed

+40
-24
lines changed

src/bootstrap/builder.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ impl RunConfig<'_> {
9797
self.builder.build.build
9898
}
9999

100-
/// Return a `-p=x -p=y` string suitable for passing to a cargo invocation.
100+
/// Return a list of crate names selected by `run.paths`.
101101
pub fn cargo_crates_in_set(&self) -> Interned<Vec<String>> {
102102
let mut crates = Vec::new();
103103
for krate in &self.paths {
104104
let path = krate.assert_single_path();
105105
let crate_name = self.builder.crate_paths[&path.path];
106-
crates.push(format!("-p={crate_name}"));
106+
crates.push(crate_name.to_string());
107107
}
108108
INTERNER.intern_list(crates)
109109
}
@@ -112,18 +112,17 @@ impl RunConfig<'_> {
112112
/// A description of the crates in this set, suitable for passing to `builder.info`.
113113
///
114114
/// `crates` should be generated by [`RunConfig::cargo_crates_in_set`].
115-
pub fn crate_description(crates: Interned<Vec<String>>) -> String {
115+
pub fn crate_description(crates: &[impl AsRef<str>]) -> String {
116116
if crates.is_empty() {
117117
return "".into();
118118
}
119119

120-
let mut descr = String::from(": {");
121-
for krate in &*crates {
122-
write!(descr, "{}, ", krate.strip_prefix("-p=").unwrap()).unwrap();
120+
let mut descr = String::from(" {");
121+
descr.push_str(crates[0].as_ref());
122+
for krate in &crates[1..] {
123+
descr.push_str(", ");
124+
descr.push_str(krate.as_ref());
123125
}
124-
125-
descr.pop();
126-
descr.pop();
127126
descr.push('}');
128127
descr
129128
}

src/bootstrap/check.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl Step for Std {
101101
std_cargo(builder, target, compiler.stage, &mut cargo);
102102

103103
builder.info(&format!(
104-
"Checking stage{} std artifacts ({} -> {})",
104+
"Checking stage{} library artifacts ({} -> {})",
105105
builder.top_stage, &compiler.host, target
106106
));
107107
run_cargo(
@@ -157,7 +157,7 @@ impl Step for Std {
157157
}
158158

159159
builder.info(&format!(
160-
"Checking stage{} std test/bench/example targets ({} -> {})",
160+
"Checking stage{} library test/bench/example targets ({} -> {})",
161161
builder.top_stage, &compiler.host, target
162162
));
163163
run_cargo(

src/bootstrap/clean.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ macro_rules! clean_crate_tree {
6666
}
6767

6868
builder.info(&format!(
69-
"Cleaning stage{} {} artifacts ({} -> {}){}",
70-
compiler.stage, stringify!($name).to_lowercase(), &compiler.host, target, crate_description(self.crates),
69+
"Cleaning{} stage{} {} artifacts ({} -> {})",
70+
crate_description(&self.crates), compiler.stage, stringify!($name).to_lowercase(), &compiler.host, target,
7171
));
7272

7373
// NOTE: doesn't use `run_cargo` because we don't want to save a stamp file,

src/bootstrap/compile.rs

+18-8
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ impl Step for Std {
111111
let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target);
112112
if compiler_to_use != compiler {
113113
builder.ensure(Std::new(compiler_to_use, target));
114-
builder.info(&format!("Uplifting stage1 std ({} -> {})", compiler_to_use.host, target));
114+
builder.info(&format!(
115+
"Uplifting stage1 library ({} -> {})",
116+
compiler_to_use.host, target
117+
));
115118

116119
// Even if we're not building std this stage, the new sysroot must
117120
// still contain the third party objects needed by various targets.
@@ -127,18 +130,21 @@ impl Step for Std {
127130

128131
let mut cargo = builder.cargo(compiler, Mode::Std, SourceType::InTree, target, "build");
129132
std_cargo(builder, target, compiler.stage, &mut cargo);
133+
for krate in &*self.crates {
134+
cargo.arg("-p").arg(krate);
135+
}
130136

131137
builder.info(&format!(
132-
"Building stage{} std artifacts ({} -> {}){}",
138+
"Building{} stage{} library artifacts ({} -> {})",
139+
crate_description(&self.crates),
133140
compiler.stage,
134141
&compiler.host,
135142
target,
136-
crate_description(self.crates),
137143
));
138144
run_cargo(
139145
builder,
140146
cargo,
141-
self.crates.to_vec(),
147+
vec![],
142148
&libstd_stamp(builder, compiler, target),
143149
target_deps,
144150
false,
@@ -429,7 +435,7 @@ impl Step for StdLink {
429435
let target_compiler = self.target_compiler;
430436
let target = self.target;
431437
builder.info(&format!(
432-
"Copying stage{} std from stage{} ({} -> {} / {})",
438+
"Copying stage{} library from stage{} ({} -> {} / {})",
433439
target_compiler.stage, compiler.stage, &compiler.host, target_compiler.host, target
434440
));
435441
let libdir = builder.sysroot_libdir(target_compiler, target);
@@ -718,17 +724,21 @@ impl Step for Rustc {
718724
}
719725
}
720726

727+
for krate in &*self.crates {
728+
cargo.arg("-p").arg(krate);
729+
}
730+
721731
builder.info(&format!(
722-
"Building stage{} compiler artifacts ({} -> {}){}",
732+
"Building{} stage{} compiler artifacts ({} -> {})",
733+
crate_description(&self.crates),
723734
compiler.stage,
724735
&compiler.host,
725736
target,
726-
crate_description(self.crates),
727737
));
728738
run_cargo(
729739
builder,
730740
cargo,
731-
self.crates.to_vec(),
741+
vec![],
732742
&librustc_stamp(builder, compiler, target),
733743
vec![],
734744
false,

src/bootstrap/doc.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use std::fs;
1212
use std::io;
1313
use std::path::{Path, PathBuf};
1414

15+
use crate::builder::crate_description;
1516
use crate::builder::{Builder, Compiler, Kind, RunConfig, ShouldRun, Step};
1617
use crate::cache::{Interned, INTERNER};
1718
use crate::compile;
@@ -554,7 +555,8 @@ fn doc_std(
554555
requested_crates: &[String],
555556
) {
556557
builder.info(&format!(
557-
"Documenting stage{} std ({}) in {} format",
558+
"Documenting{} stage{} library ({}) in {} format",
559+
crate_description(requested_crates),
558560
stage,
559561
target,
560562
format.as_str()

src/bootstrap/test.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use std::iter;
1111
use std::path::{Path, PathBuf};
1212
use std::process::{Command, Stdio};
1313

14+
use crate::builder::crate_description;
1415
use crate::builder::{Builder, Compiler, Kind, RunConfig, ShouldRun, Step};
1516
use crate::cache::Interned;
1617
use crate::compile;
@@ -2154,8 +2155,12 @@ impl Step for Crate {
21542155
}
21552156

21562157
builder.info(&format!(
2157-
"{} {:?} stage{} ({} -> {})",
2158-
test_kind, self.crates, compiler.stage, &compiler.host, target
2158+
"{}{} stage{} ({} -> {})",
2159+
test_kind,
2160+
crate_description(&self.crates),
2161+
compiler.stage,
2162+
&compiler.host,
2163+
target
21592164
));
21602165
let _time = util::timeit(&builder);
21612166
try_run(builder, &mut cargo.into());

0 commit comments

Comments
 (0)