Skip to content

Commit

Permalink
Don't print opt fuel messages to stdout because it breaks Rustbuild
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wesleywiser committed Oct 30, 2018
1 parent d586d5d commit a7bea73
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/librustc/session/mod.rs
Expand Up @@ -868,7 +868,7 @@ impl Session {
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);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_driver/lib.rs
Expand Up @@ -944,7 +944,7 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
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());
}
Expand Down

0 comments on commit a7bea73

Please sign in to comment.