From 84443a3a241a1e513ba03bd40d4ffd623a3ff381 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Wed, 5 Dec 2018 21:48:25 -0700 Subject: [PATCH] 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. --- src/librustc/util/profiling.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc/util/profiling.rs b/src/librustc/util/profiling.rs index bea3453b31a..1e648c45817 100644 --- a/src/librustc/util/profiling.rs +++ b/src/librustc/util/profiling.rs @@ -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 @@ 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, "| ---------------- | -------------- | -------------- | -------- |") @@ -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 =