Skip to content

Commit a7bea73

Browse files
committed
Don't print opt fuel messages to stdout because it breaks Rustbuild
Rustbuild passes `--message-format json` to the compiler invocations which causes JSON to be emitted on stdout. Printing optimization fuel messages to stdout breaks the json and causes Rustbuild to fail. Work around this by emitting optimization fuel related messages on stderr instead.
1 parent d586d5d commit a7bea73

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/librustc/session/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ impl Session {
868868
let fuel = self.optimization_fuel_limit.get();
869869
ret = fuel != 0;
870870
if fuel == 0 && !self.out_of_fuel.get() {
871-
println!("optimization-fuel-exhausted: {}", msg());
871+
eprintln!("optimization-fuel-exhausted: {}", msg());
872872
self.out_of_fuel.set(true);
873873
} else if fuel > 0 {
874874
self.optimization_fuel_limit.set(fuel - 1);

src/librustc_driver/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
944944
control.compilation_done.callback = box move |state| {
945945
old_callback(state);
946946
let sess = state.session;
947-
println!("Fuel used by {}: {}",
947+
eprintln!("Fuel used by {}: {}",
948948
sess.print_fuel_crate.as_ref().unwrap(),
949949
sess.print_fuel.get());
950950
}

0 commit comments

Comments
 (0)