Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/librustc_errors/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 2 additions & 0 deletions src/test/run-make-fulldeps/treat-err-as-bug/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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\`'"
4 changes: 4 additions & 0 deletions src/test/run-make-fulldeps/treat-err-as-bug/delay_span_bug.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#![feature(rustc_attrs)]

#[rustc_error(delay_span_bug_from_inside_query)]
fn main() {}