Skip to content

Commit 099c587

Browse files
authored
Rollup merge of rust-lang#55495 - wesleywiser:opt_fuel_rustbuild, r=nikomatsakis
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.
2 parents 88f214c + 22b571d commit 099c587

File tree

8 files changed

+8
-5
lines changed

8 files changed

+8
-5
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
@@ -952,7 +952,7 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
952952
control.compilation_done.callback = box move |state| {
953953
old_callback(state);
954954
let sess = state.session;
955-
println!("Fuel used by {}: {}",
955+
eprintln!("Fuel used by {}: {}",
956956
sess.print_fuel_crate.as_ref().unwrap(),
957957
sess.print_fuel.get());
958958
}

src/test/run-pass/optimization-fuel-0.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
use std::mem::size_of;
1414

15-
// compile-flags: -Z fuel=foo=0
15+
// (#55495: The --error-format is to sidestep an issue in our test harness)
16+
// compile-flags: --error-format human -Z fuel=foo=0
1617

1718
struct S1(u8, u16, u8);
1819
struct S2(u8, u16, u8);

src/test/run-pass/optimization-fuel-1.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
use std::mem::size_of;
1414

15-
// compile-flags: -Z fuel=foo=1
15+
// (#55495: The --error-format is to sidestep an issue in our test harness)
16+
// compile-flags: --error-format human -Z fuel=foo=1
1617

1718
struct S1(u8, u16, u8);
1819
struct S2(u8, u16, u8);

src/test/ui/print-fuel/print-fuel.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
#![crate_name="foo"]
1212
#![allow(dead_code)]
1313

14-
// compile-flags: -Z print-fuel=foo
14+
// (#55495: The --error-format is to sidestep an issue in our test harness)
15+
// compile-flags: --error-format human -Z print-fuel=foo
1516
// compile-pass
1617

1718
struct S1(u8, u16, u8);

0 commit comments

Comments
 (0)