mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Fix overflow in rustc happening if the err_count()
is reduced in a stage.
This can happen if stashed diagnostics are removed or replaced with fewer errors. The semantics stay the same if built without overflow. Fixes #84219.
This commit is contained in:
parent
49ca3d9796
commit
5ff06fb77f
@ -450,8 +450,7 @@ impl Session {
|
||||
{
|
||||
let old_count = self.err_count();
|
||||
let result = f();
|
||||
let errors = self.err_count() - old_count;
|
||||
if errors == 0 { Ok(result) } else { Err(ErrorReported) }
|
||||
if self.err_count() == old_count { Ok(result) } else { Err(ErrorReported) }
|
||||
}
|
||||
pub fn span_warn<S: Into<MultiSpan>>(&self, sp: S, msg: &str) {
|
||||
self.diagnostic().span_warn(sp, msg)
|
||||
|
Loading…
Reference in New Issue
Block a user