mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
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
This commit is contained in:
commit
2b5325dbff
@ -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);
|
||||
}
|
||||
|
@ -3,3 +3,5 @@
|
||||
all:
|
||||
$(RUSTC) err.rs -Z treat-err-as-bug 2>&1 \
|
||||
| $(CGREP) "panicked at 'aborting due to \`-Z treat-err-as-bug=1\`'"
|
||||
$(RUSTC) delay_span_bug.rs -Z treat-err-as-bug 2>&1 \
|
||||
| $(CGREP) "panicked at 'aborting due to \`-Z treat-err-as-bug=1\`'"
|
||||
|
@ -0,0 +1,4 @@
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
#[rustc_error(delay_span_bug_from_inside_query)]
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user