Skip to content

Commit ef17859

Browse files
Rollup merge of #82782 - pnkfelix:include-crate-being-compiled-in-bootstrap-verbose-output, r=Mark-Simulacrum
Make rustc shim's verbose output include crate_name being compiled. This change is mainly motivated by an issue with the environment printing I added in PR 82403: multiple rustc invocations progress in parallel, and the environment output, spanning multiple lines, gets interleaved in ways make it difficult to extra the enviroment settings. (This aforementioned difficulty is more of a hiccup than an outright show-stopper, because the environment variables tend to be the same for all of the rustc invocations, so it doesn't matter too much if one mixes up which lines one is looking at. But still: Better to fix it.)
2 parents 15c148b + 444a756 commit ef17859

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/bootstrap/bin/rustc.rs

+12-6
Original file line numberDiff line numberDiff line change
@@ -138,21 +138,28 @@ fn main() {
138138
cmd.arg("-Z").arg("force-unstable-if-unmarked");
139139
}
140140

141+
let is_test = args.iter().any(|a| a == "--test");
141142
if verbose > 1 {
142143
let rust_env_vars =
143144
env::vars().filter(|(k, _)| k.starts_with("RUST") || k.starts_with("CARGO"));
145+
let prefix = if is_test { "[RUSTC-SHIM] rustc --test" } else { "[RUSTC-SHIM] rustc" };
146+
let prefix = match crate_name {
147+
Some(crate_name) => format!("{} {}", prefix, crate_name),
148+
None => prefix.to_string(),
149+
};
144150
for (i, (k, v)) in rust_env_vars.enumerate() {
145-
eprintln!("rustc env[{}]: {:?}={:?}", i, k, v);
151+
eprintln!("{} env[{}]: {:?}={:?}", prefix, i, k, v);
146152
}
147-
eprintln!("rustc working directory: {}", env::current_dir().unwrap().display());
153+
eprintln!("{} working directory: {}", prefix, env::current_dir().unwrap().display());
148154
eprintln!(
149-
"rustc command: {:?}={:?} {:?}",
155+
"{} command: {:?}={:?} {:?}",
156+
prefix,
150157
bootstrap::util::dylib_path_var(),
151158
env::join_paths(&dylib_path).unwrap(),
152159
cmd,
153160
);
154-
eprintln!("sysroot: {:?}", sysroot);
155-
eprintln!("libdir: {:?}", libdir);
161+
eprintln!("{} sysroot: {:?}", prefix, sysroot);
162+
eprintln!("{} libdir: {:?}", prefix, libdir);
156163
}
157164

158165
let start = Instant::now();
@@ -166,7 +173,6 @@ fn main() {
166173
{
167174
if let Some(crate_name) = crate_name {
168175
let dur = start.elapsed();
169-
let is_test = args.iter().any(|a| a == "--test");
170176
// If the user requested resource usage data, then
171177
// include that in addition to the timing output.
172178
let rusage_data =

0 commit comments

Comments
 (0)