Skip to content

Commit

Permalink
Make rustc shim's verbose output include crate_name being compiled.
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
pnkfelix committed Mar 4, 2021
1 parent 4099208 commit f5eb5c8
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/bootstrap/bin/rustc.rs
Expand Up @@ -141,18 +141,23 @@ fn main() {
if verbose > 1 {
let rust_env_vars =
env::vars().filter(|(k, _)| k.starts_with("RUST") || k.starts_with("CARGO"));
let prefix = match crate_name {
Some(crate_name) => format!("rustc {}", crate_name),
None => "rustc".to_string(),
};
for (i, (k, v)) in rust_env_vars.enumerate() {
eprintln!("rustc env[{}]: {:?}={:?}", i, k, v);
eprintln!("{} env[{}]: {:?}={:?}", prefix, i, k, v);
}
eprintln!("rustc working directory: {}", env::current_dir().unwrap().display());
eprintln!("{} working directory: {}", prefix, env::current_dir().unwrap().display());
eprintln!(
"rustc command: {:?}={:?} {:?}",
"{} command: {:?}={:?} {:?}",
prefix,
bootstrap::util::dylib_path_var(),
env::join_paths(&dylib_path).unwrap(),
cmd,
);
eprintln!("sysroot: {:?}", sysroot);
eprintln!("libdir: {:?}", libdir);
eprintln!("{} sysroot: {:?}", prefix, sysroot);
eprintln!("{} libdir: {:?}", prefix, libdir);
}

let start = Instant::now();
Expand Down

0 comments on commit f5eb5c8

Please sign in to comment.