Rollup merge of #56555 - Mark-Simulacrum:stderr-profile, r=wesleywiser

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
This commit is contained in:
kennytm 2018-12-07 12:42:34 +08:00 committed by GitHub
commit aa5ba8315a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {
@ -61,7 +61,7 @@ fn new() -> CategoryData {
}
}
fn print(&self, lock: &mut StdoutLock<'_>) {
fn print(&self, lock: &mut StderrLock<'_>) {
writeln!(lock, "| Phase | Time (ms) | Queries | Hits (%) |")
.unwrap();
writeln!(lock, "| ---------------- | -------------- | -------------- | -------- |")
@ -235,7 +235,7 @@ pub fn print_results(&mut self, opts: &Options) {
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 =