Skip to content

Commit f5eb5c8

Browse files
committed
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.)
1 parent 4099208 commit f5eb5c8

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/bootstrap/bin/rustc.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,23 @@ fn main() {
141141
if verbose > 1 {
142142
let rust_env_vars =
143143
env::vars().filter(|(k, _)| k.starts_with("RUST") || k.starts_with("CARGO"));
144+
let prefix = match crate_name {
145+
Some(crate_name) => format!("rustc {}", crate_name),
146+
None => "rustc".to_string(),
147+
};
144148
for (i, (k, v)) in rust_env_vars.enumerate() {
145-
eprintln!("rustc env[{}]: {:?}={:?}", i, k, v);
149+
eprintln!("{} env[{}]: {:?}={:?}", prefix, i, k, v);
146150
}
147-
eprintln!("rustc working directory: {}", env::current_dir().unwrap().display());
151+
eprintln!("{} working directory: {}", prefix, env::current_dir().unwrap().display());
148152
eprintln!(
149-
"rustc command: {:?}={:?} {:?}",
153+
"{} command: {:?}={:?} {:?}",
154+
prefix,
150155
bootstrap::util::dylib_path_var(),
151156
env::join_paths(&dylib_path).unwrap(),
152157
cmd,
153158
);
154-
eprintln!("sysroot: {:?}", sysroot);
155-
eprintln!("libdir: {:?}", libdir);
159+
eprintln!("{} sysroot: {:?}", prefix, sysroot);
160+
eprintln!("{} libdir: {:?}", prefix, libdir);
156161
}
157162

158163
let start = Instant::now();

0 commit comments

Comments
 (0)