summaryrefslogtreecommitdiffstats
path: root/tests/ui/panics
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/panics')
-rw-r--r--tests/ui/panics/panic-in-cleanup.rs23
-rw-r--r--tests/ui/panics/panic-in-cleanup.run.stderr9
-rw-r--r--tests/ui/panics/panic-in-ffi.rs18
-rw-r--r--tests/ui/panics/panic-in-ffi.run.stderr7
-rw-r--r--tests/ui/panics/short-ice-remove-middle-frames-2.rs1
-rw-r--r--tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr2
-rw-r--r--tests/ui/panics/short-ice-remove-middle-frames.rs1
-rw-r--r--tests/ui/panics/short-ice-remove-middle-frames.run.stderr2
8 files changed, 61 insertions, 2 deletions
diff --git a/tests/ui/panics/panic-in-cleanup.rs b/tests/ui/panics/panic-in-cleanup.rs
new file mode 100644
index 000000000..84880f188
--- /dev/null
+++ b/tests/ui/panics/panic-in-cleanup.rs
@@ -0,0 +1,23 @@
+// run-fail
+// exec-env:RUST_BACKTRACE=0
+// check-run-results
+// error-pattern: panic in a destructor during cleanup
+// normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
+// normalize-stderr-test: "\n +at [^\n]+" -> ""
+// normalize-stderr-test: "(core/src/panicking\.rs):[0-9]+:[0-9]+" -> "$1:$$LINE:$$COL"
+// needs-unwind
+// ignore-emscripten "RuntimeError" junk in output
+// ignore-msvc SEH doesn't do panic-during-cleanup the same way as everyone else
+
+struct Bomb;
+
+impl Drop for Bomb {
+ fn drop(&mut self) {
+ panic!("BOOM");
+ }
+}
+
+fn main() {
+ let _b = Bomb;
+ panic!();
+}
diff --git a/tests/ui/panics/panic-in-cleanup.run.stderr b/tests/ui/panics/panic-in-cleanup.run.stderr
new file mode 100644
index 000000000..e7def11b0
--- /dev/null
+++ b/tests/ui/panics/panic-in-cleanup.run.stderr
@@ -0,0 +1,9 @@
+thread 'main' panicked at $DIR/panic-in-cleanup.rs:22:5:
+explicit panic
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+thread 'main' panicked at $DIR/panic-in-cleanup.rs:16:9:
+BOOM
+stack backtrace:
+thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
+panic in a destructor during cleanup
+thread caused non-unwinding panic. aborting.
diff --git a/tests/ui/panics/panic-in-ffi.rs b/tests/ui/panics/panic-in-ffi.rs
new file mode 100644
index 000000000..d9f1fcee8
--- /dev/null
+++ b/tests/ui/panics/panic-in-ffi.rs
@@ -0,0 +1,18 @@
+// run-fail
+// exec-env:RUST_BACKTRACE=0
+// check-run-results
+// error-pattern: panic in a function that cannot unwind
+// normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
+// normalize-stderr-test: "\n +at [^\n]+" -> ""
+// normalize-stderr-test: "(core/src/panicking\.rs):[0-9]+:[0-9]+" -> "$1:$$LINE:$$COL"
+// needs-unwind
+// ignore-emscripten "RuntimeError" junk in output
+#![feature(c_unwind)]
+
+extern "C" fn panic_in_ffi() {
+ panic!("Test");
+}
+
+fn main() {
+ panic_in_ffi();
+}
diff --git a/tests/ui/panics/panic-in-ffi.run.stderr b/tests/ui/panics/panic-in-ffi.run.stderr
new file mode 100644
index 000000000..a92a66c57
--- /dev/null
+++ b/tests/ui/panics/panic-in-ffi.run.stderr
@@ -0,0 +1,7 @@
+thread 'main' panicked at $DIR/panic-in-ffi.rs:13:5:
+Test
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+thread 'main' panicked at library/core/src/panicking.rs:$LINE:$COL:
+panic in a function that cannot unwind
+stack backtrace:
+thread caused non-unwinding panic. aborting.
diff --git a/tests/ui/panics/short-ice-remove-middle-frames-2.rs b/tests/ui/panics/short-ice-remove-middle-frames-2.rs
index 38a80f8b6..751959f55 100644
--- a/tests/ui/panics/short-ice-remove-middle-frames-2.rs
+++ b/tests/ui/panics/short-ice-remove-middle-frames-2.rs
@@ -2,6 +2,7 @@
// run-fail
// check-run-results
// exec-env:RUST_BACKTRACE=1
+// needs-unwind
// ignore-android FIXME #17520
// ignore-wasm no panic support
// ignore-openbsd no support for libbacktrace without filename
diff --git a/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr b/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr
index 2b648a0ca..664ebaa4c 100644
--- a/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr
+++ b/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr
@@ -1,4 +1,4 @@
-thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:56:5:
+thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:57:5:
debug!!!
stack backtrace:
0: std::panicking::begin_panic
diff --git a/tests/ui/panics/short-ice-remove-middle-frames.rs b/tests/ui/panics/short-ice-remove-middle-frames.rs
index c872084f0..134e13233 100644
--- a/tests/ui/panics/short-ice-remove-middle-frames.rs
+++ b/tests/ui/panics/short-ice-remove-middle-frames.rs
@@ -2,6 +2,7 @@
// run-fail
// check-run-results
// exec-env:RUST_BACKTRACE=1
+// needs-unwind
// ignore-android FIXME #17520
// ignore-wasm no panic support
// ignore-openbsd no support for libbacktrace without filename
diff --git a/tests/ui/panics/short-ice-remove-middle-frames.run.stderr b/tests/ui/panics/short-ice-remove-middle-frames.run.stderr
index 5b3726840..bc252fde1 100644
--- a/tests/ui/panics/short-ice-remove-middle-frames.run.stderr
+++ b/tests/ui/panics/short-ice-remove-middle-frames.run.stderr
@@ -1,4 +1,4 @@
-thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:52:5:
+thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:53:5:
debug!!!
stack backtrace:
0: std::panicking::begin_panic