diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-04-28 13:12:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-28 13:12:14 +0200 |
| commit | 2b5325dbff4021f64181199eaa6d9d34139ce42f (patch) | |
| tree | a7b9155ef3e52eb624b2dadad836038d59e55a8e /src/librustc_errors | |
| parent | 5aebbe9ea270df05806964b02b68a25baa22f1d8 (diff) | |
| parent | 3fe280451bcc7dc2a2debf71a4d5747df0f0e0fd (diff) | |
Rollup merge of #71489 - spastorino:fix-treat-err-as-bug-handling, r=eddyb
Fix off by one in treat err as bug `-Ztreat-err-as-bug` doesn't work properly with delay_span_bug. r? @eddyb
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/lib.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 151241fdb0b..e4a560e434a 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -869,7 +869,10 @@ impl HandlerInner { } fn delay_span_bug(&mut self, sp: impl Into<MultiSpan>, msg: &str) { - if self.treat_err_as_bug() { + // This is technically `self.treat_err_as_bug()` but `delay_span_bug` is called before + // incrementing `err_count` by one, so we need to +1 the comparing. + // FIXME: Would be nice to increment err_count in a more coherent way. + if self.flags.treat_err_as_bug.map(|c| self.err_count() + 1 >= c).unwrap_or(false) { // FIXME: don't abort here if report_delayed_bugs is off self.span_bug(sp, msg); } |
