Skip to content

Commit

Permalink
Revise prefix a bit, adding both --test (conditionally) and `[RUSTC…
Browse files Browse the repository at this point in the history
…-SHIM]` unconditionally.

1. I added `--test` based on review feedback from simulacrum: I decided I would
rather include such extra context than get confused later on by its absence.
(However, I chose to encode it differently than how `[RUSTC-TIMING]` does... I
don't have much basis for doing so, other than `--test` to me more directly
reflects what it came from.)

2. I also decided to include `[RUSTC-SHIM]` at start of all of these lines
driven by the verbosity level, to make to clear where these lines of text
originate from. (Basically, I skimmed over the output and realized that a casual
observer might not be able to tell where this huge set of new lines were coming
from.)
  • Loading branch information
pnkfelix committed Mar 5, 2021
1 parent f5eb5c8 commit 444a756
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/bootstrap/bin/rustc.rs
Expand Up @@ -138,12 +138,14 @@ fn main() {
cmd.arg("-Z").arg("force-unstable-if-unmarked");
}

let is_test = args.iter().any(|a| a == "--test");
if verbose > 1 {
let rust_env_vars =
env::vars().filter(|(k, _)| k.starts_with("RUST") || k.starts_with("CARGO"));
let prefix = if is_test { "[RUSTC-SHIM] rustc --test" } else { "[RUSTC-SHIM] rustc" };
let prefix = match crate_name {
Some(crate_name) => format!("rustc {}", crate_name),
None => "rustc".to_string(),
Some(crate_name) => format!("{} {}", prefix, crate_name),
None => prefix.to_string(),
};
for (i, (k, v)) in rust_env_vars.enumerate() {
eprintln!("{} env[{}]: {:?}={:?}", prefix, i, k, v);
Expand Down Expand Up @@ -171,7 +173,6 @@ fn main() {
{
if let Some(crate_name) = crate_name {
let dur = start.elapsed();
let is_test = args.iter().any(|a| a == "--test");
// If the user requested resource usage data, then
// include that in addition to the timing output.
let rusage_data =
Expand Down

0 comments on commit 444a756

Please sign in to comment.