Only bump error count when we are sure that the diagnostic is not a repetition.

This ensures that if we emit the same diagnostic twice, the error count will
match the real number of errors shown to the user.

Fixes #42106
This commit is contained in:
Rafael Fernández López 2018-01-02 20:00:12 +01:00
parent 687d3d15ba
commit 063607eecb
No known key found for this signature in database
GPG key ID: 8902294E78418CF9
8 changed files with 14 additions and 20 deletions

View file

@ -588,6 +588,9 @@ impl Handler {
// one:
if self.emitted_diagnostics.borrow_mut().insert(diagnostic_hash) {
self.emitter.borrow_mut().emit(db);
if db.is_error() {
self.bump_err_count();
}
}
}
}