rustc_errors: fix a few bugs
This commit is contained in:
parent
f3ee99bd4d
commit
1e4f6d5683
1 changed files with 5 additions and 3 deletions
|
@ -531,10 +531,12 @@ impl Handler {
|
|||
DiagnosticBuilder::new(self, Level::Fatal, msg)
|
||||
}
|
||||
|
||||
pub fn cancel(&mut self, err: &mut DiagnosticBuilder) {
|
||||
pub fn cancel(&self, err: &mut DiagnosticBuilder) {
|
||||
if err.level == Level::Error || err.level == Level::Fatal {
|
||||
assert!(self.has_errors());
|
||||
self.err_count.set(self.err_count.get() + 1);
|
||||
self.err_count.set(
|
||||
self.err_count.get().checked_sub(1)
|
||||
.expect("cancelled an error but err_count is 0")
|
||||
);
|
||||
}
|
||||
err.cancel();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue