fix bad logic

This commit is contained in:
Esteban Küber 2019-03-07 08:09:41 -08:00
parent c41ddf1773
commit a7563a30c0
2 changed files with 4 additions and 3 deletions

View File

@ -103,7 +103,9 @@ impl<'a> DiagnosticBuilder<'a> {
/// Buffers the diagnostic for later emission, unless handler
/// has disabled such buffering.
pub fn buffer(mut self, buffered_diagnostics: &mut Vec<Diagnostic>) {
if self.handler.flags.dont_buffer_diagnostics || self.handler.treat_err_as_bug() {
if self.handler.flags.dont_buffer_diagnostics ||
self.handler.flags.treat_err_as_bug.is_some()
{
self.emit();
return;
}

View File

@ -657,8 +657,7 @@ impl Handler {
1 => "aborting due to previous error".to_string(),
_ => format!("aborting due to {} previous errors", self.err_count())
};
let err_as_bug = self.flags.treat_err_as_bug.unwrap_or(0);
if self.err_count() >= err_as_bug {
if self.treat_err_as_bug() {
return;
}