diff --git a/src/librustc_session/session.rs b/src/librustc_session/session.rs index 4b1cc71c822f3..b39b15dc24428 100644 --- a/src/librustc_session/session.rs +++ b/src/librustc_session/session.rs @@ -808,7 +808,7 @@ impl Session { let mut fuel = self.optimization_fuel.lock(); ret = fuel.remaining != 0; 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; } else if fuel.remaining > 0 { fuel.remaining -= 1; diff --git a/src/test/ui/optimization-fuel-0.rs b/src/test/ui/optimization-fuel-0.rs index f86972b734826..a97c5750f94c3 100644 --- a/src/test/ui/optimization-fuel-0.rs +++ b/src/test/ui/optimization-fuel-0.rs @@ -4,8 +4,7 @@ use std::mem::size_of; -// (#55495: The --error-format is to sidestep an issue in our test harness) -// compile-flags: --error-format human -Z fuel=foo=0 +// compile-flags: -Z fuel=foo=0 struct S1(u8, u16, u8); struct S2(u8, u16, u8); diff --git a/src/test/ui/optimization-fuel-0.stderr b/src/test/ui/optimization-fuel-0.stderr index 3ad405b2b50ff..f0e2ebfc37a37 100644 --- a/src/test/ui/optimization-fuel-0.stderr +++ b/src/test/ui/optimization-fuel-0.stderr @@ -1 +1,4 @@ -optimization-fuel-exhausted: Reorder fields of "S1" +warning: optimization-fuel-exhausted: Reorder fields of "S1" + +warning: 1 warning emitted + diff --git a/src/test/ui/optimization-fuel-1.rs b/src/test/ui/optimization-fuel-1.rs index 98283066361c2..a09f91c68abe7 100644 --- a/src/test/ui/optimization-fuel-1.rs +++ b/src/test/ui/optimization-fuel-1.rs @@ -4,8 +4,7 @@ use std::mem::size_of; -// (#55495: The --error-format is to sidestep an issue in our test harness) -// compile-flags: --error-format human -Z fuel=foo=1 +// compile-flags: -Z fuel=foo=1 struct S1(u8, u16, u8); struct S2(u8, u16, u8); diff --git a/src/test/ui/optimization-fuel-1.stderr b/src/test/ui/optimization-fuel-1.stderr index 197e45219c3f8..53eafb05830cb 100644 --- a/src/test/ui/optimization-fuel-1.stderr +++ b/src/test/ui/optimization-fuel-1.stderr @@ -1 +1,4 @@ -optimization-fuel-exhausted: Reorder fields of "S2" +warning: optimization-fuel-exhausted: Reorder fields of "S2" + +warning: 1 warning emitted +