Skip to content

Commit

Permalink
Rollup merge of rust-lang#56555 - Mark-Simulacrum:stderr-profile, r=w…
Browse files Browse the repository at this point in the history
…esleywiser

Send textual profile data to stderr, not stdout

This makes it possible to run with RUSTFLAGS="-Zself-profile" without
having to redirect compiler output; otherwise Cargo will error out due
to non-empty compiler stdout.

r? @wesleywiser
  • Loading branch information
kennytm authored Dec 7, 2018
2 parents 0e41ef1 + 84443a3 commit aa5ba83
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/librustc/util/profiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use session::config::Options;

use std::fs;
use std::io::{self, StdoutLock, Write};
use std::io::{self, StderrLock, Write};
use std::time::{Duration, Instant};

macro_rules! define_categories {
Expand Down Expand Up @@ -61,7 +61,7 @@ macro_rules! define_categories {
}
}

fn print(&self, lock: &mut StdoutLock<'_>) {
fn print(&self, lock: &mut StderrLock<'_>) {
writeln!(lock, "| Phase | Time (ms) | Queries | Hits (%) |")
.unwrap();
writeln!(lock, "| ---------------- | -------------- | -------------- | -------- |")
Expand Down Expand Up @@ -235,7 +235,7 @@ impl SelfProfiler {
self.timer_stack.is_empty(),
"there were timers running when print_results() was called");

let out = io::stdout();
let out = io::stderr();
let mut lock = out.lock();

let crate_name =
Expand Down

0 comments on commit aa5ba83

Please sign in to comment.