mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-25 21:34:18 +00:00
Emit a warning when optimization fuel runs out
`eprintln!` gets swallowed by Cargo too easily.
This commit is contained in:
parent
bad3bf622b
commit
62116c31cd
@ -813,7 +813,7 @@ impl Session {
|
|||||||
let mut fuel = self.optimization_fuel.lock();
|
let mut fuel = self.optimization_fuel.lock();
|
||||||
ret = fuel.remaining != 0;
|
ret = fuel.remaining != 0;
|
||||||
if fuel.remaining == 0 && !fuel.out_of_fuel {
|
if fuel.remaining == 0 && !fuel.out_of_fuel {
|
||||||
eprintln!("optimization-fuel-exhausted: {}", msg());
|
self.warn(&format!("optimization-fuel-exhausted: {}", msg()));
|
||||||
fuel.out_of_fuel = true;
|
fuel.out_of_fuel = true;
|
||||||
} else if fuel.remaining > 0 {
|
} else if fuel.remaining > 0 {
|
||||||
fuel.remaining -= 1;
|
fuel.remaining -= 1;
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
|
|
||||||
use std::mem::size_of;
|
use std::mem::size_of;
|
||||||
|
|
||||||
// (#55495: The --error-format is to sidestep an issue in our test harness)
|
// compile-flags: -Z fuel=foo=0
|
||||||
// compile-flags: --error-format human -Z fuel=foo=0
|
|
||||||
|
|
||||||
struct S1(u8, u16, u8);
|
struct S1(u8, u16, u8);
|
||||||
struct S2(u8, u16, u8);
|
struct S2(u8, u16, u8);
|
||||||
|
@ -1 +1,4 @@
|
|||||||
optimization-fuel-exhausted: Reorder fields of "S1"
|
warning: optimization-fuel-exhausted: Reorder fields of "S1"
|
||||||
|
|
||||||
|
warning: 1 warning emitted
|
||||||
|
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
|
|
||||||
use std::mem::size_of;
|
use std::mem::size_of;
|
||||||
|
|
||||||
// (#55495: The --error-format is to sidestep an issue in our test harness)
|
// compile-flags: -Z fuel=foo=1
|
||||||
// compile-flags: --error-format human -Z fuel=foo=1
|
|
||||||
|
|
||||||
struct S1(u8, u16, u8);
|
struct S1(u8, u16, u8);
|
||||||
struct S2(u8, u16, u8);
|
struct S2(u8, u16, u8);
|
||||||
|
@ -1 +1,4 @@
|
|||||||
optimization-fuel-exhausted: Reorder fields of "S2"
|
warning: optimization-fuel-exhausted: Reorder fields of "S2"
|
||||||
|
|
||||||
|
warning: 1 warning emitted
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user