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.
This commit is contained in:
Wesley Wiser
2018-10-23 21:13:03 -04:00
parent d586d5d2f5
commit a7bea73292
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -868,7 +868,7 @@ pub fn consider_optimizing<T: Fn() -> String>(&self, crate_name: &str, msg: T) -
let fuel = self.optimization_fuel_limit.get();
ret = fuel != 0;
if fuel == 0 && !self.out_of_fuel.get() {
println!("optimization-fuel-exhausted: {}", msg());
eprintln!("optimization-fuel-exhausted: {}", msg());
self.out_of_fuel.set(true);
} else if fuel > 0 {
self.optimization_fuel_limit.set(fuel - 1);
+1 -1
View File
@@ -944,7 +944,7 @@ fn build_controller(self: Box<Self>,
control.compilation_done.callback = box move |state| {
old_callback(state);
let sess = state.session;
println!("Fuel used by {}: {}",
eprintln!("Fuel used by {}: {}",
sess.print_fuel_crate.as_ref().unwrap(),
sess.print_fuel.get());
}