From 47644d3d43b5f5000f7bef00698c3bfc77f8f771 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Fri, 24 Apr 2020 17:22:55 -0300 Subject: [PATCH 1/4] Create ui test for -Ztreat-err-as-bug err --- src/test/ui/treat-err-as-bug/err.rs | 11 +++++++++++ src/test/ui/treat-err-as-bug/err.stderr | 12 ++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/test/ui/treat-err-as-bug/err.rs create mode 100644 src/test/ui/treat-err-as-bug/err.stderr diff --git a/src/test/ui/treat-err-as-bug/err.rs b/src/test/ui/treat-err-as-bug/err.rs new file mode 100644 index 0000000000000..5442d8585941b --- /dev/null +++ b/src/test/ui/treat-err-as-bug/err.rs @@ -0,0 +1,11 @@ +// compile-flags: -Ztreat-err-as-bug +// failure-status: 101 +// error-pattern: aborting due to `-Z treat-err-as-bug=1` +// error-pattern: [eval_to_allocation_raw] const-evaluating + checking `C` +// normalize-stderr-test "note: .*\n\n" -> "" +// normalize-stderr-test "thread 'rustc' panicked.*\n" -> "" + +#![crate_type = "rlib"] + +pub static C: u32 = 0 - 1; +//~^ ERROR could not evaluate static initializer diff --git a/src/test/ui/treat-err-as-bug/err.stderr b/src/test/ui/treat-err-as-bug/err.stderr new file mode 100644 index 0000000000000..61eb85c40a112 --- /dev/null +++ b/src/test/ui/treat-err-as-bug/err.stderr @@ -0,0 +1,12 @@ +error[E0080]: could not evaluate static initializer + --> $DIR/err.rs:10:21 + | +LL | pub static C: u32 = 0 - 1; + | ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow + +error: internal compiler error: unexpected panic + +query stack during panic: +#0 [eval_to_allocation_raw] const-evaluating + checking `C` +#1 [eval_to_allocation_raw] const-evaluating + checking `C` +end of query stack From 748b550bf61992c5e4f6a24d7e718912783faec8 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 7 Feb 2021 01:49:35 -0300 Subject: [PATCH 2/4] Remove treat-err-as-bug err test from run-make-fulldeps --- src/test/run-make-fulldeps/treat-err-as-bug/err.rs | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 src/test/run-make-fulldeps/treat-err-as-bug/err.rs diff --git a/src/test/run-make-fulldeps/treat-err-as-bug/err.rs b/src/test/run-make-fulldeps/treat-err-as-bug/err.rs deleted file mode 100644 index 136b2f3070299..0000000000000 --- a/src/test/run-make-fulldeps/treat-err-as-bug/err.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type="rlib"] - -pub static C: u32 = 0-1; From 1d35960fe1898dd370c360bbf60ca4fa89bbf93d Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 7 Feb 2021 01:44:29 -0300 Subject: [PATCH 3/4] Create ui test for -Ztreat-err-as-bug delay_span_bug --- src/test/ui/treat-err-as-bug/delay_span_bug.rs | 11 +++++++++++ src/test/ui/treat-err-as-bug/delay_span_bug.stderr | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/test/ui/treat-err-as-bug/delay_span_bug.rs create mode 100644 src/test/ui/treat-err-as-bug/delay_span_bug.stderr diff --git a/src/test/ui/treat-err-as-bug/delay_span_bug.rs b/src/test/ui/treat-err-as-bug/delay_span_bug.rs new file mode 100644 index 0000000000000..67846336acaaf --- /dev/null +++ b/src/test/ui/treat-err-as-bug/delay_span_bug.rs @@ -0,0 +1,11 @@ +// compile-flags: -Ztreat-err-as-bug +// failure-status: 101 +// error-pattern: aborting due to `-Z treat-err-as-bug=1` +// error-pattern: [trigger_delay_span_bug] trigger a delay span bug +// normalize-stderr-test "note: .*\n\n" -> "" +// normalize-stderr-test "thread 'rustc' panicked.*\n" -> "" + +#![feature(rustc_attrs)] + +#[rustc_error(delay_span_bug_from_inside_query)] +fn main() {} diff --git a/src/test/ui/treat-err-as-bug/delay_span_bug.stderr b/src/test/ui/treat-err-as-bug/delay_span_bug.stderr new file mode 100644 index 0000000000000..ed65b69ebcab1 --- /dev/null +++ b/src/test/ui/treat-err-as-bug/delay_span_bug.stderr @@ -0,0 +1,11 @@ +error: internal compiler error: delayed span bug triggered by #[rustc_error(delay_span_bug_from_inside_query)] + --> $DIR/delay_span_bug.rs:11:1 + | +LL | fn main() {} + | ^^^^^^^^^ + +error: internal compiler error: unexpected panic + +query stack during panic: +#0 [trigger_delay_span_bug] trigger a delay span bug +end of query stack From 6d9efd17e527850b2caf48fcbf547d6d3ca4e39d Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 7 Feb 2021 01:50:17 -0300 Subject: [PATCH 4/4] Remove treat-err-as-bug delay_span_bug test from run-make-fulldeps --- src/test/run-make-fulldeps/treat-err-as-bug/Makefile | 7 ------- .../run-make-fulldeps/treat-err-as-bug/delay_span_bug.rs | 4 ---- 2 files changed, 11 deletions(-) delete mode 100644 src/test/run-make-fulldeps/treat-err-as-bug/Makefile delete mode 100644 src/test/run-make-fulldeps/treat-err-as-bug/delay_span_bug.rs diff --git a/src/test/run-make-fulldeps/treat-err-as-bug/Makefile b/src/test/run-make-fulldeps/treat-err-as-bug/Makefile deleted file mode 100644 index 57cac76aec2a5..0000000000000 --- a/src/test/run-make-fulldeps/treat-err-as-bug/Makefile +++ /dev/null @@ -1,7 +0,0 @@ --include ../tools.mk - -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\`'" diff --git a/src/test/run-make-fulldeps/treat-err-as-bug/delay_span_bug.rs b/src/test/run-make-fulldeps/treat-err-as-bug/delay_span_bug.rs deleted file mode 100644 index dad33e498b52f..0000000000000 --- a/src/test/run-make-fulldeps/treat-err-as-bug/delay_span_bug.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![feature(rustc_attrs)] - -#[rustc_error(delay_span_bug_from_inside_query)] -fn main() {}