File tree 2 files changed +14
-1
lines changed
compiler/rustc_session/src
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -902,7 +902,12 @@ impl Session {
902
902
let mut fuel = self . optimization_fuel . lock ( ) ;
903
903
ret = fuel. remaining != 0 ;
904
904
if fuel. remaining == 0 && !fuel. out_of_fuel {
905
- self . warn ( & format ! ( "optimization-fuel-exhausted: {}" , msg( ) ) ) ;
905
+ if self . diagnostic ( ) . can_emit_warnings ( ) {
906
+ // We only call `msg` in case we can actually emit warnings.
907
+ // Otherwise, this could cause a `delay_good_path_bug` to
908
+ // trigger (issue #79546).
909
+ self . warn ( & format ! ( "optimization-fuel-exhausted: {}" , msg( ) ) ) ;
910
+ }
906
911
fuel. out_of_fuel = true ;
907
912
} else if fuel. remaining > 0 {
908
913
fuel. remaining -= 1 ;
Original file line number Diff line number Diff line change
1
+ // Regression test for the ICE described in #79546.
2
+
3
+ // compile-flags: --cap-lints=allow -Zfuel=issue79546=0
4
+ // check-pass
5
+ #![ crate_name="issue79546" ]
6
+
7
+ struct S ;
8
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments