mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-09 13:33:43 +00:00
Fix ICE with --cap-lints=allow
and -Zfuel=...=0
This commit is contained in:
parent
3bb9eecf07
commit
8c5bdb973a
@ -902,7 +902,12 @@ 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 {
|
||||||
self.warn(&format!("optimization-fuel-exhausted: {}", msg()));
|
if self.diagnostic().can_emit_warnings() {
|
||||||
|
// We only call `msg` in case we can actually emit warnings.
|
||||||
|
// Otherwise, this could cause a `delay_good_path_bug` to
|
||||||
|
// trigger (issue #79546).
|
||||||
|
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;
|
||||||
|
8
src/test/ui/lint/issue-79546-fuel-ice.rs
Normal file
8
src/test/ui/lint/issue-79546-fuel-ice.rs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Regression test for the ICE described in #79546.
|
||||||
|
|
||||||
|
// compile-flags: --cap-lints=allow -Zfuel=issue79546=0
|
||||||
|
// check-pass
|
||||||
|
#![crate_name="issue79546"]
|
||||||
|
|
||||||
|
struct S;
|
||||||
|
fn main() {}
|
Loading…
Reference in New Issue
Block a user