summaryrefslogtreecommitdiffstats
path: root/src/test/ui/panics
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/panics
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/panics')
-rw-r--r--src/test/ui/panics/abort-on-panic.rs98
-rw-r--r--src/test/ui/panics/args-panic.rs11
-rw-r--r--src/test/ui/panics/default-backtrace-ice.rs9
-rw-r--r--src/test/ui/panics/default-backtrace-ice.stderr18
-rw-r--r--src/test/ui/panics/doublepanic.rs10
-rw-r--r--src/test/ui/panics/explicit-panic-msg.rs15
-rw-r--r--src/test/ui/panics/explicit-panic.rs7
-rw-r--r--src/test/ui/panics/fmt-panic.rs8
-rw-r--r--src/test/ui/panics/issue-47429-short-backtraces.legacy.run.stderr5
-rw-r--r--src/test/ui/panics/issue-47429-short-backtraces.rs24
-rw-r--r--src/test/ui/panics/issue-47429-short-backtraces.v0.run.stderr5
-rw-r--r--src/test/ui/panics/location-detail-panic-no-column.rs8
-rw-r--r--src/test/ui/panics/location-detail-panic-no-column.run.stderr2
-rw-r--r--src/test/ui/panics/location-detail-panic-no-file.rs8
-rw-r--r--src/test/ui/panics/location-detail-panic-no-file.run.stderr2
-rw-r--r--src/test/ui/panics/location-detail-panic-no-line.rs8
-rw-r--r--src/test/ui/panics/location-detail-panic-no-line.run.stderr2
-rw-r--r--src/test/ui/panics/location-detail-panic-no-location-info.rs8
-rw-r--r--src/test/ui/panics/location-detail-panic-no-location-info.run.stderr2
-rw-r--r--src/test/ui/panics/location-detail-unwrap-no-file.rs9
-rw-r--r--src/test/ui/panics/location-detail-unwrap-no-file.run.stderr2
-rw-r--r--src/test/ui/panics/main-panic.rs7
-rw-r--r--src/test/ui/panics/panic-2021.rs9
-rw-r--r--src/test/ui/panics/panic-2021.stderr42
-rw-r--r--src/test/ui/panics/panic-arg.rs11
-rw-r--r--src/test/ui/panics/panic-handler-chain-update-hook.rs36
-rw-r--r--src/test/ui/panics/panic-handler-chain.rs30
-rw-r--r--src/test/ui/panics/panic-handler-flail-wildly.rs56
-rw-r--r--src/test/ui/panics/panic-handler-set-twice.rs25
-rw-r--r--src/test/ui/panics/panic-in-dtor-drops-fields.rs38
-rw-r--r--src/test/ui/panics/panic-macro-any-wrapped.rs9
-rw-r--r--src/test/ui/panics/panic-macro-any.rs9
-rw-r--r--src/test/ui/panics/panic-macro-explicit.rs7
-rw-r--r--src/test/ui/panics/panic-macro-fmt.rs7
-rw-r--r--src/test/ui/panics/panic-macro-owned.rs7
-rw-r--r--src/test/ui/panics/panic-macro-static.rs7
-rw-r--r--src/test/ui/panics/panic-main.rs7
-rw-r--r--src/test/ui/panics/panic-parens.rs20
-rw-r--r--src/test/ui/panics/panic-recover-propagate.rs27
-rw-r--r--src/test/ui/panics/panic-set-handler.rs12
-rw-r--r--src/test/ui/panics/panic-set-unset-handler.rs13
-rw-r--r--src/test/ui/panics/panic-short-backtrace-windows-x86_64.rs53
-rw-r--r--src/test/ui/panics/panic-short-backtrace-windows-x86_64.run.stderr9
-rw-r--r--src/test/ui/panics/panic-take-handler-nop.rs10
-rw-r--r--src/test/ui/panics/panic-task-name-none.rs13
-rw-r--r--src/test/ui/panics/panic-task-name-owned.rs18
-rw-r--r--src/test/ui/panics/panic.rs7
-rw-r--r--src/test/ui/panics/result-get-panic.rs9
-rw-r--r--src/test/ui/panics/runtime-switch.legacy.run.stderr5
-rw-r--r--src/test/ui/panics/runtime-switch.rs27
-rw-r--r--src/test/ui/panics/runtime-switch.v0.run.stderr5
-rw-r--r--src/test/ui/panics/test-panic.rs9
-rw-r--r--src/test/ui/panics/test-should-fail-bad-message.rs10
-rw-r--r--src/test/ui/panics/test-should-panic-bad-message.rs10
-rw-r--r--src/test/ui/panics/test-should-panic-no-message.rs10
-rw-r--r--src/test/ui/panics/unique-panic.rs10
-rw-r--r--src/test/ui/panics/while-body-panics.rs14
-rw-r--r--src/test/ui/panics/while-panic.rs14
58 files changed, 0 insertions, 873 deletions
diff --git a/src/test/ui/panics/abort-on-panic.rs b/src/test/ui/panics/abort-on-panic.rs
deleted file mode 100644
index 1f6ad64c0..000000000
--- a/src/test/ui/panics/abort-on-panic.rs
+++ /dev/null
@@ -1,98 +0,0 @@
-// run-pass
-
-#![allow(unused_must_use)]
-#![feature(c_unwind)]
-#![feature(panic_always_abort)]
-// Since we mark some ABIs as "nounwind" to LLVM, we must make sure that
-// we never unwind through them.
-
-// ignore-emscripten no processes
-// ignore-sgx no processes
-
-use std::io;
-use std::io::prelude::*;
-use std::process::{exit, Command, Stdio};
-use std::sync::{Arc, Barrier};
-use std::thread;
-use std::{env, panic};
-
-extern "C" fn panic_in_ffi() {
- panic!("Test");
-}
-
-fn should_have_aborted() {
- io::stdout().write(b"This should never be printed.\n");
- let _ = io::stdout().flush();
-}
-
-fn bomb_out_but_not_abort(msg: &str) {
- eprintln!("bombing out: {}", msg);
- exit(1);
-}
-
-fn test() {
- let _ = panic::catch_unwind(|| {
- panic_in_ffi();
- });
- should_have_aborted();
-}
-
-fn test_always_abort() {
- panic::always_abort();
- let _ = panic::catch_unwind(|| {
- panic!();
- });
- should_have_aborted();
-}
-
-fn test_always_abort_thread() {
- let barrier = Arc::new(Barrier::new(2));
- let thr = {
- let barrier = barrier.clone();
- thread::spawn(move || {
- barrier.wait();
- panic!("in thread");
- })
- };
- panic::always_abort();
- barrier.wait();
- let _ = thr.join();
- bomb_out_but_not_abort("joined - but we were supposed to panic!");
-}
-
-fn main() {
- let tests: &[(_, fn())] = &[
- ("test", test),
- ("test_always_abort", test_always_abort),
- ("test_always_abort_thread", test_always_abort_thread),
- ];
-
- let args: Vec<String> = env::args().collect();
- if args.len() > 1 {
- // This is inside the self-executed command.
- for (a, f) in tests {
- if &args[1] == a {
- return f();
- }
- }
- bomb_out_but_not_abort("bad test");
- }
-
- let execute_self_expecting_abort = |arg| {
- let mut p = Command::new(&args[0])
- .stdout(Stdio::piped())
- .stdin(Stdio::piped())
- .arg(arg)
- .spawn()
- .unwrap();
- let status = p.wait().unwrap();
- assert!(!status.success());
- // Any reasonable platform can distinguish a process which
- // called exit(1) from one which panicked.
- assert_ne!(status.code(), Some(1));
- };
-
- for (a, _f) in tests {
- execute_self_expecting_abort(a);
- }
-}
diff --git a/src/test/ui/panics/args-panic.rs b/src/test/ui/panics/args-panic.rs
deleted file mode 100644
index 7636025c2..000000000
--- a/src/test/ui/panics/args-panic.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// run-fail
-// error-pattern:meep
-// ignore-emscripten no processes
-
-fn f(_a: isize, _b: isize, _c: Box<isize>) {
- panic!("moop");
-}
-
-fn main() {
- f(1, panic!("meep"), Box::new(42));
-}
diff --git a/src/test/ui/panics/default-backtrace-ice.rs b/src/test/ui/panics/default-backtrace-ice.rs
deleted file mode 100644
index fd86a3f9d..000000000
--- a/src/test/ui/panics/default-backtrace-ice.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// unset-rustc-env:RUST_BACKTRACE
-// compile-flags:-Z treat-err-as-bug=1
-// error-pattern:stack backtrace:
-// failure-status:101
-// normalize-stderr-test "note: .*" -> ""
-// normalize-stderr-test "thread 'rustc' .*" -> ""
-// normalize-stderr-test " .*\n" -> ""
-
-fn main() { missing_ident; }
diff --git a/src/test/ui/panics/default-backtrace-ice.stderr b/src/test/ui/panics/default-backtrace-ice.stderr
deleted file mode 100644
index a0025d7e2..000000000
--- a/src/test/ui/panics/default-backtrace-ice.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0425]: cannot find value `missing_ident` in this scope
-LL | fn main() { missing_ident; }
-
-
-stack backtrace:
-
-error: internal compiler error: unexpected panic
-
-
-
-
-
-
-
-
-
-query stack during panic:
-end of query stack
diff --git a/src/test/ui/panics/doublepanic.rs b/src/test/ui/panics/doublepanic.rs
deleted file mode 100644
index c1fcc875c..000000000
--- a/src/test/ui/panics/doublepanic.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-#![allow(unreachable_code)]
-
-// run-fail
-// error-pattern:One
-// ignore-emscripten no processes
-
-fn main() {
- panic!("One");
- panic!("Two");
-}
diff --git a/src/test/ui/panics/explicit-panic-msg.rs b/src/test/ui/panics/explicit-panic-msg.rs
deleted file mode 100644
index 9d8035787..000000000
--- a/src/test/ui/panics/explicit-panic-msg.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-#![allow(unused_assignments)]
-#![allow(unused_variables)]
-#![allow(non_fmt_panics)]
-
-// run-fail
-// error-pattern:wooooo
-// ignore-emscripten no processes
-
-fn main() {
- let mut a = 1;
- if 1 == 1 {
- a = 2;
- }
- panic!(format!("woooo{}", "o"));
-}
diff --git a/src/test/ui/panics/explicit-panic.rs b/src/test/ui/panics/explicit-panic.rs
deleted file mode 100644
index 27c73d349..000000000
--- a/src/test/ui/panics/explicit-panic.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-// run-fail
-// error-pattern:explicit
-// ignore-emscripten no processes
-
-fn main() {
- panic!();
-}
diff --git a/src/test/ui/panics/fmt-panic.rs b/src/test/ui/panics/fmt-panic.rs
deleted file mode 100644
index 87fb2e6dd..000000000
--- a/src/test/ui/panics/fmt-panic.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// run-fail
-// error-pattern:meh
-// ignore-emscripten no processes
-
-fn main() {
- let str_var: String = "meh".to_string();
- panic!("{}", str_var);
-}
diff --git a/src/test/ui/panics/issue-47429-short-backtraces.legacy.run.stderr b/src/test/ui/panics/issue-47429-short-backtraces.legacy.run.stderr
deleted file mode 100644
index ac4ed8225..000000000
--- a/src/test/ui/panics/issue-47429-short-backtraces.legacy.run.stderr
+++ /dev/null
@@ -1,5 +0,0 @@
-thread 'main' panicked at 'explicit panic', $DIR/issue-47429-short-backtraces.rs:23:5
-stack backtrace:
- 0: std::panicking::begin_panic
- 1: issue_47429_short_backtraces::main
-note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
diff --git a/src/test/ui/panics/issue-47429-short-backtraces.rs b/src/test/ui/panics/issue-47429-short-backtraces.rs
deleted file mode 100644
index 58d0fa62c..000000000
--- a/src/test/ui/panics/issue-47429-short-backtraces.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Regression test for #47429: short backtraces were not terminating correctly
-
-// compile-flags: -O
-// compile-flags:-Cstrip=none
-// run-fail
-// check-run-results
-// exec-env:RUST_BACKTRACE=1
-
-// ignore-msvc see #62897 and `backtrace-debuginfo.rs` test
-// ignore-android FIXME #17520
-// ignore-openbsd no support for libbacktrace without filename
-// ignore-wasm no panic or subprocess support
-// ignore-emscripten no panic or subprocess support
-// ignore-sgx no subprocess support
-// ignore-fuchsia Backtraces not symbolized
-
-// NOTE(eddyb) output differs between symbol mangling schemes
-// revisions: legacy v0
-// [legacy] compile-flags: -Zunstable-options -Csymbol-mangling-version=legacy
-// [v0] compile-flags: -Csymbol-mangling-version=v0
-
-fn main() {
- panic!()
-}
diff --git a/src/test/ui/panics/issue-47429-short-backtraces.v0.run.stderr b/src/test/ui/panics/issue-47429-short-backtraces.v0.run.stderr
deleted file mode 100644
index 65401fe1c..000000000
--- a/src/test/ui/panics/issue-47429-short-backtraces.v0.run.stderr
+++ /dev/null
@@ -1,5 +0,0 @@
-thread 'main' panicked at 'explicit panic', $DIR/issue-47429-short-backtraces.rs:23:5
-stack backtrace:
- 0: std::panicking::begin_panic::<&str>
- 1: issue_47429_short_backtraces::main
-note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
diff --git a/src/test/ui/panics/location-detail-panic-no-column.rs b/src/test/ui/panics/location-detail-panic-no-column.rs
deleted file mode 100644
index 7cf1bb09c..000000000
--- a/src/test/ui/panics/location-detail-panic-no-column.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// run-fail
-// check-run-results
-// compile-flags: -Zlocation-detail=line,file
-// exec-env:RUST_BACKTRACE=0
-
-fn main() {
- panic!("column-redacted");
-}
diff --git a/src/test/ui/panics/location-detail-panic-no-column.run.stderr b/src/test/ui/panics/location-detail-panic-no-column.run.stderr
deleted file mode 100644
index 46c9b8448..000000000
--- a/src/test/ui/panics/location-detail-panic-no-column.run.stderr
+++ /dev/null
@@ -1,2 +0,0 @@
-thread 'main' panicked at 'column-redacted', $DIR/location-detail-panic-no-column.rs:7:0
-note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/src/test/ui/panics/location-detail-panic-no-file.rs b/src/test/ui/panics/location-detail-panic-no-file.rs
deleted file mode 100644
index 9bcbf01d1..000000000
--- a/src/test/ui/panics/location-detail-panic-no-file.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// run-fail
-// check-run-results
-// compile-flags: -Zlocation-detail=line,column
-// exec-env:RUST_BACKTRACE=0
-
-fn main() {
- panic!("file-redacted");
-}
diff --git a/src/test/ui/panics/location-detail-panic-no-file.run.stderr b/src/test/ui/panics/location-detail-panic-no-file.run.stderr
deleted file mode 100644
index 811f93bf3..000000000
--- a/src/test/ui/panics/location-detail-panic-no-file.run.stderr
+++ /dev/null
@@ -1,2 +0,0 @@
-thread 'main' panicked at 'file-redacted', <redacted>:7:5
-note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/src/test/ui/panics/location-detail-panic-no-line.rs b/src/test/ui/panics/location-detail-panic-no-line.rs
deleted file mode 100644
index 25df092e1..000000000
--- a/src/test/ui/panics/location-detail-panic-no-line.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// run-fail
-// check-run-results
-// compile-flags: -Zlocation-detail=file,column
-// exec-env:RUST_BACKTRACE=0
-
-fn main() {
- panic!("line-redacted");
-}
diff --git a/src/test/ui/panics/location-detail-panic-no-line.run.stderr b/src/test/ui/panics/location-detail-panic-no-line.run.stderr
deleted file mode 100644
index cc3f1624c..000000000
--- a/src/test/ui/panics/location-detail-panic-no-line.run.stderr
+++ /dev/null
@@ -1,2 +0,0 @@
-thread 'main' panicked at 'line-redacted', $DIR/location-detail-panic-no-line.rs:0:5
-note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/src/test/ui/panics/location-detail-panic-no-location-info.rs b/src/test/ui/panics/location-detail-panic-no-location-info.rs
deleted file mode 100644
index 7b609145b..000000000
--- a/src/test/ui/panics/location-detail-panic-no-location-info.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// run-fail
-// check-run-results
-// compile-flags: -Zlocation-detail=none
-// exec-env:RUST_BACKTRACE=0
-
-fn main() {
- panic!("no location info");
-}
diff --git a/src/test/ui/panics/location-detail-panic-no-location-info.run.stderr b/src/test/ui/panics/location-detail-panic-no-location-info.run.stderr
deleted file mode 100644
index d1c310864..000000000
--- a/src/test/ui/panics/location-detail-panic-no-location-info.run.stderr
+++ /dev/null
@@ -1,2 +0,0 @@
-thread 'main' panicked at 'no location info', <redacted>:0:0
-note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/src/test/ui/panics/location-detail-unwrap-no-file.rs b/src/test/ui/panics/location-detail-unwrap-no-file.rs
deleted file mode 100644
index 5955d9a25..000000000
--- a/src/test/ui/panics/location-detail-unwrap-no-file.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// run-fail
-// check-run-results
-// compile-flags: -Copt-level=0 -Zlocation-detail=line,column
-// exec-env:RUST_BACKTRACE=0
-
-fn main() {
- let opt: Option<u32> = None;
- opt.unwrap();
-}
diff --git a/src/test/ui/panics/location-detail-unwrap-no-file.run.stderr b/src/test/ui/panics/location-detail-unwrap-no-file.run.stderr
deleted file mode 100644
index 7d8e1d930..000000000
--- a/src/test/ui/panics/location-detail-unwrap-no-file.run.stderr
+++ /dev/null
@@ -1,2 +0,0 @@
-thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', <redacted>:8:9
-note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/src/test/ui/panics/main-panic.rs b/src/test/ui/panics/main-panic.rs
deleted file mode 100644
index 023ab4701..000000000
--- a/src/test/ui/panics/main-panic.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-// run-fail
-// error-pattern:thread 'main' panicked at
-// ignore-emscripten no processes
-
-fn main() {
- panic!()
-}
diff --git a/src/test/ui/panics/panic-2021.rs b/src/test/ui/panics/panic-2021.rs
deleted file mode 100644
index e606612e1..000000000
--- a/src/test/ui/panics/panic-2021.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// edition:2021
-
-fn main() {
- panic!(123); //~ ERROR: format argument must be a string literal
- panic!("{}"); //~ ERROR: 1 positional argument in format string
- core::panic!("{}"); //~ ERROR: 1 positional argument in format string
- assert!(false, 123); //~ ERROR: format argument must be a string literal
- assert!(false, "{}"); //~ ERROR: 1 positional argument in format string
-}
diff --git a/src/test/ui/panics/panic-2021.stderr b/src/test/ui/panics/panic-2021.stderr
deleted file mode 100644
index 373c1c2c0..000000000
--- a/src/test/ui/panics/panic-2021.stderr
+++ /dev/null
@@ -1,42 +0,0 @@
-error: format argument must be a string literal
- --> $DIR/panic-2021.rs:4:12
- |
-LL | panic!(123);
- | ^^^
- |
-help: you might be missing a string literal to format with
- |
-LL | panic!("{}", 123);
- | +++++
-
-error: 1 positional argument in format string, but no arguments were given
- --> $DIR/panic-2021.rs:5:13
- |
-LL | panic!("{}");
- | ^^
-
-error: 1 positional argument in format string, but no arguments were given
- --> $DIR/panic-2021.rs:6:19
- |
-LL | core::panic!("{}");
- | ^^
-
-error: format argument must be a string literal
- --> $DIR/panic-2021.rs:7:20
- |
-LL | assert!(false, 123);
- | ^^^
- |
-help: you might be missing a string literal to format with
- |
-LL | assert!(false, "{}", 123);
- | +++++
-
-error: 1 positional argument in format string, but no arguments were given
- --> $DIR/panic-2021.rs:8:21
- |
-LL | assert!(false, "{}");
- | ^^
-
-error: aborting due to 5 previous errors
-
diff --git a/src/test/ui/panics/panic-arg.rs b/src/test/ui/panics/panic-arg.rs
deleted file mode 100644
index f7c2dbb09..000000000
--- a/src/test/ui/panics/panic-arg.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// run-fail
-// error-pattern:woe
-// ignore-emscripten no processes
-
-fn f(a: isize) {
- println!("{}", a);
-}
-
-fn main() {
- f(panic!("woe"));
-}
diff --git a/src/test/ui/panics/panic-handler-chain-update-hook.rs b/src/test/ui/panics/panic-handler-chain-update-hook.rs
deleted file mode 100644
index 4dd08ba4a..000000000
--- a/src/test/ui/panics/panic-handler-chain-update-hook.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// run-pass
-// needs-unwind
-#![allow(stable_features)]
-
-// ignore-emscripten no threads support
-
-#![feature(std_panic)]
-#![feature(panic_update_hook)]
-
-use std::sync::atomic::{AtomicUsize, Ordering};
-use std::panic;
-use std::thread;
-
-static A: AtomicUsize = AtomicUsize::new(0);
-static B: AtomicUsize = AtomicUsize::new(0);
-static C: AtomicUsize = AtomicUsize::new(0);
-
-fn main() {
- panic::set_hook(Box::new(|_| { A.fetch_add(1, Ordering::SeqCst); }));
- panic::update_hook(|prev, info| {
- B.fetch_add(1, Ordering::SeqCst);
- prev(info);
- });
- panic::update_hook(|prev, info| {
- C.fetch_add(1, Ordering::SeqCst);
- prev(info);
- });
-
- let _ = thread::spawn(|| {
- panic!();
- }).join();
-
- assert_eq!(1, A.load(Ordering::SeqCst));
- assert_eq!(1, B.load(Ordering::SeqCst));
- assert_eq!(1, C.load(Ordering::SeqCst));
-}
diff --git a/src/test/ui/panics/panic-handler-chain.rs b/src/test/ui/panics/panic-handler-chain.rs
deleted file mode 100644
index 73d6e790d..000000000
--- a/src/test/ui/panics/panic-handler-chain.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-// run-pass
-// needs-unwind
-#![allow(stable_features)]
-
-// ignore-emscripten no threads support
-
-#![feature(std_panic)]
-
-use std::sync::atomic::{AtomicUsize, Ordering};
-use std::panic;
-use std::thread;
-
-static A: AtomicUsize = AtomicUsize::new(0);
-static B: AtomicUsize = AtomicUsize::new(0);
-
-fn main() {
- panic::set_hook(Box::new(|_| { A.fetch_add(1, Ordering::SeqCst); }));
- let hook = panic::take_hook();
- panic::set_hook(Box::new(move |info| {
- B.fetch_add(1, Ordering::SeqCst);
- hook(info);
- }));
-
- let _ = thread::spawn(|| {
- panic!();
- }).join();
-
- assert_eq!(1, A.load(Ordering::SeqCst));
- assert_eq!(1, B.load(Ordering::SeqCst));
-}
diff --git a/src/test/ui/panics/panic-handler-flail-wildly.rs b/src/test/ui/panics/panic-handler-flail-wildly.rs
deleted file mode 100644
index 679dc7de8..000000000
--- a/src/test/ui/panics/panic-handler-flail-wildly.rs
+++ /dev/null
@@ -1,56 +0,0 @@
-// run-pass
-// needs-unwind
-
-#![allow(stable_features)]
-#![allow(unused_must_use)]
-
-// ignore-emscripten no threads support
-
-#![feature(std_panic)]
-
-use std::panic;
-use std::thread;
-
-fn a() {
- panic::set_hook(Box::new(|_| println!("hello yes this is a")));
- panic::take_hook();
- panic::set_hook(Box::new(|_| println!("hello yes this is a part 2")));
- panic::take_hook();
-}
-
-fn b() {
- panic::take_hook();
- panic::take_hook();
- panic::take_hook();
- panic::take_hook();
- panic::take_hook();
- panic!();
-}
-
-fn c() {
- panic::set_hook(Box::new(|_| ()));
- panic::set_hook(Box::new(|_| ()));
- panic::set_hook(Box::new(|_| ()));
- panic::set_hook(Box::new(|_| ()));
- panic::set_hook(Box::new(|_| ()));
- panic::set_hook(Box::new(|_| ()));
- panic!();
-}
-
-fn main() {
- for _ in 0..10 {
- let mut handles = vec![];
- for _ in 0..10 {
- handles.push(thread::spawn(a));
- }
- for _ in 0..10 {
- handles.push(thread::spawn(b));
- }
- for _ in 0..10 {
- handles.push(thread::spawn(c));
- }
- for handle in handles {
- let _ = handle.join();
- }
- }
-}
diff --git a/src/test/ui/panics/panic-handler-set-twice.rs b/src/test/ui/panics/panic-handler-set-twice.rs
deleted file mode 100644
index 274453020..000000000
--- a/src/test/ui/panics/panic-handler-set-twice.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-// run-pass
-// needs-unwind
-#![allow(unused_variables)]
-#![allow(stable_features)]
-
-#![feature(std_panic)]
-
-// ignore-emscripten no threads support
-
-use std::sync::atomic::{AtomicUsize, Ordering};
-use std::panic;
-use std::thread;
-
-static A: AtomicUsize = AtomicUsize::new(0);
-
-fn main() {
- panic::set_hook(Box::new(|_| ()));
- panic::set_hook(Box::new(|info| { A.fetch_add(1, Ordering::SeqCst); }));
-
- let _ = thread::spawn(|| {
- panic!();
- }).join();
-
- assert_eq!(1, A.load(Ordering::SeqCst));
-}
diff --git a/src/test/ui/panics/panic-in-dtor-drops-fields.rs b/src/test/ui/panics/panic-in-dtor-drops-fields.rs
deleted file mode 100644
index c0963aa31..000000000
--- a/src/test/ui/panics/panic-in-dtor-drops-fields.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-// run-pass
-// needs-unwind
-#![allow(dead_code)]
-#![allow(non_upper_case_globals)]
-
-// ignore-emscripten no threads support
-
-use std::thread;
-
-static mut dropped: bool = false;
-
-struct A {
- b: B,
-}
-
-struct B {
- foo: isize,
-}
-
-impl Drop for A {
- fn drop(&mut self) {
- panic!()
- }
-}
-
-impl Drop for B {
- fn drop(&mut self) {
- unsafe { dropped = true; }
- }
-}
-
-pub fn main() {
- let ret = thread::spawn(move|| {
- let _a = A { b: B { foo: 3 } };
- }).join();
- assert!(ret.is_err());
- unsafe { assert!(dropped); }
-}
diff --git a/src/test/ui/panics/panic-macro-any-wrapped.rs b/src/test/ui/panics/panic-macro-any-wrapped.rs
deleted file mode 100644
index 663bf6713..000000000
--- a/src/test/ui/panics/panic-macro-any-wrapped.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// run-fail
-// error-pattern:panicked at 'Box<dyn Any>'
-// ignore-emscripten no processes
-
-#![allow(non_fmt_panics)]
-
-fn main() {
- panic!(Box::new(612_i64));
-}
diff --git a/src/test/ui/panics/panic-macro-any.rs b/src/test/ui/panics/panic-macro-any.rs
deleted file mode 100644
index c7df53654..000000000
--- a/src/test/ui/panics/panic-macro-any.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// run-fail
-// error-pattern:panicked at 'Box<dyn Any>'
-// ignore-emscripten no processes
-
-#![allow(non_fmt_panics)]
-
-fn main() {
- panic!(Box::new(413) as Box<dyn std::any::Any + Send>);
-}
diff --git a/src/test/ui/panics/panic-macro-explicit.rs b/src/test/ui/panics/panic-macro-explicit.rs
deleted file mode 100644
index ac4d6f812..000000000
--- a/src/test/ui/panics/panic-macro-explicit.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-// run-fail
-// error-pattern:panicked at 'explicit panic'
-// ignore-emscripten no processes
-
-fn main() {
- panic!();
-}
diff --git a/src/test/ui/panics/panic-macro-fmt.rs b/src/test/ui/panics/panic-macro-fmt.rs
deleted file mode 100644
index a755ebc0f..000000000
--- a/src/test/ui/panics/panic-macro-fmt.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-// run-fail
-// error-pattern:panicked at 'test-fail-fmt 42 rust'
-// ignore-emscripten no processes
-
-fn main() {
- panic!("test-fail-fmt {} {}", 42, "rust");
-}
diff --git a/src/test/ui/panics/panic-macro-owned.rs b/src/test/ui/panics/panic-macro-owned.rs
deleted file mode 100644
index b898fde77..000000000
--- a/src/test/ui/panics/panic-macro-owned.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-// run-fail
-// error-pattern:panicked at 'test-fail-owned'
-// ignore-emscripten no processes
-
-fn main() {
- panic!("test-fail-owned");
-}
diff --git a/src/test/ui/panics/panic-macro-static.rs b/src/test/ui/panics/panic-macro-static.rs
deleted file mode 100644
index a1d467cbf..000000000
--- a/src/test/ui/panics/panic-macro-static.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-// run-fail
-// error-pattern:panicked at 'test-fail-static'
-// ignore-emscripten no processes
-
-fn main() {
- panic!("test-fail-static");
-}
diff --git a/src/test/ui/panics/panic-main.rs b/src/test/ui/panics/panic-main.rs
deleted file mode 100644
index 87df7688f..000000000
--- a/src/test/ui/panics/panic-main.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-// run-fail
-// error-pattern:moop
-// ignore-emscripten no processes
-
-fn main() {
- panic!("moop");
-}
diff --git a/src/test/ui/panics/panic-parens.rs b/src/test/ui/panics/panic-parens.rs
deleted file mode 100644
index 59ab54446..000000000
--- a/src/test/ui/panics/panic-parens.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Fail macros without arguments need to be disambiguated in
-// certain positions
-
-// run-fail
-// error-pattern:oops
-// ignore-emscripten no processes
-
-fn bigpanic() {
- while (panic!("oops")) {
- if (panic!()) {
- match (panic!()) {
- () => {}
- }
- }
- }
-}
-
-fn main() {
- bigpanic();
-}
diff --git a/src/test/ui/panics/panic-recover-propagate.rs b/src/test/ui/panics/panic-recover-propagate.rs
deleted file mode 100644
index e110d94b6..000000000
--- a/src/test/ui/panics/panic-recover-propagate.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-// run-pass
-// needs-unwind
-// ignore-emscripten no threads support
-
-use std::sync::atomic::{AtomicUsize, Ordering};
-use std::panic;
-use std::thread;
-
-static A: AtomicUsize = AtomicUsize::new(0);
-
-fn main() {
- panic::set_hook(Box::new(|_| {
- A.fetch_add(1, Ordering::SeqCst);
- }));
-
- let result = thread::spawn(|| {
- let result = panic::catch_unwind(|| {
- panic!("hi there");
- });
-
- panic::resume_unwind(result.unwrap_err());
- }).join();
-
- let msg = *result.unwrap_err().downcast::<&'static str>().unwrap();
- assert_eq!("hi there", msg);
- assert_eq!(1, A.load(Ordering::SeqCst));
-}
diff --git a/src/test/ui/panics/panic-set-handler.rs b/src/test/ui/panics/panic-set-handler.rs
deleted file mode 100644
index 3c00183e2..000000000
--- a/src/test/ui/panics/panic-set-handler.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// run-fail
-// error-pattern:greetings from the panic handler
-// ignore-emscripten no processes
-
-use std::panic;
-
-fn main() {
- panic::set_hook(Box::new(|i| {
- eprintln!("greetings from the panic handler");
- }));
- panic!("foobar");
-}
diff --git a/src/test/ui/panics/panic-set-unset-handler.rs b/src/test/ui/panics/panic-set-unset-handler.rs
deleted file mode 100644
index dde0c72f7..000000000
--- a/src/test/ui/panics/panic-set-unset-handler.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// run-fail
-// error-pattern:thread 'main' panicked at 'foobar'
-// ignore-emscripten no processes
-
-use std::panic;
-
-fn main() {
- panic::set_hook(Box::new(|i| {
- eprint!("greetings from the panic handler");
- }));
- panic::take_hook();
- panic!("foobar");
-}
diff --git a/src/test/ui/panics/panic-short-backtrace-windows-x86_64.rs b/src/test/ui/panics/panic-short-backtrace-windows-x86_64.rs
deleted file mode 100644
index 39ffe86dd..000000000
--- a/src/test/ui/panics/panic-short-backtrace-windows-x86_64.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-// This test has been spuriously failing a lot recently (#92000).
-// Ignore it until the underlying issue is fixed.
-// ignore-test
-
-// Regression test for #87481: short backtrace formatting cut off the entire stack trace.
-
-// Codegen-units is specified here so that we can replicate a typical rustc invocation which
-// is not normally limited to 1 CGU. This is important so that the `__rust_begin_short_backtrace`
-// and `__rust_end_short_backtrace` symbols are not marked internal to the CGU and thus will be
-// named in the symbol table.
-// compile-flags: -O -Ccodegen-units=8
-
-// run-fail
-// check-run-results
-// exec-env:RUST_BACKTRACE=1
-
-// We need to normalize out frame 5 because without debug info, dbghelp.dll doesn't know where CGU
-// internal functions like `main` start or end and so it will return whatever symbol happens
-// to be located near the address.
-// normalize-stderr-test: "5: .*" -> "5: some Rust fn"
-
-// Backtraces are pretty broken in general on i686-pc-windows-msvc (#62897).
-// only-x86_64-pc-windows-msvc
-
-fn main() {
- a();
-}
-
-// Make these no_mangle so dbghelp.dll can figure out the symbol names.
-
-#[no_mangle]
-#[inline(never)]
-fn a() {
- b();
-}
-
-#[no_mangle]
-#[inline(never)]
-fn b() {
- c();
-}
-
-#[no_mangle]
-#[inline(never)]
-fn c() {
- d();
-}
-
-#[no_mangle]
-#[inline(never)]
-fn d() {
- panic!("d was called");
-}
diff --git a/src/test/ui/panics/panic-short-backtrace-windows-x86_64.run.stderr b/src/test/ui/panics/panic-short-backtrace-windows-x86_64.run.stderr
deleted file mode 100644
index 799a8b30e..000000000
--- a/src/test/ui/panics/panic-short-backtrace-windows-x86_64.run.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-thread 'main' panicked at 'd was called', $DIR/panic-short-backtrace-windows-x86_64.rs:48:5
-stack backtrace:
- 0: std::panicking::begin_panic
- 1: d
- 2: c
- 3: b
- 4: a
- 5: some Rust fn
-note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
diff --git a/src/test/ui/panics/panic-take-handler-nop.rs b/src/test/ui/panics/panic-take-handler-nop.rs
deleted file mode 100644
index 41cbac97c..000000000
--- a/src/test/ui/panics/panic-take-handler-nop.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// run-fail
-// error-pattern:thread 'main' panicked at 'foobar'
-// ignore-emscripten no processes
-
-use std::panic;
-
-fn main() {
- panic::take_hook();
- panic!("foobar");
-}
diff --git a/src/test/ui/panics/panic-task-name-none.rs b/src/test/ui/panics/panic-task-name-none.rs
deleted file mode 100644
index 4e95fb5bd..000000000
--- a/src/test/ui/panics/panic-task-name-none.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// run-fail
-// error-pattern:thread '<unnamed>' panicked at 'test'
-// ignore-emscripten Needs threads
-
-use std::thread;
-
-fn main() {
- let r: Result<(), _> = thread::spawn(move || {
- panic!("test");
- })
- .join();
- assert!(r.is_ok());
-}
diff --git a/src/test/ui/panics/panic-task-name-owned.rs b/src/test/ui/panics/panic-task-name-owned.rs
deleted file mode 100644
index f85be7bb8..000000000
--- a/src/test/ui/panics/panic-task-name-owned.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// run-fail
-// error-pattern:thread 'owned name' panicked at 'test'
-// ignore-emscripten Needs threads.
-
-use std::thread::Builder;
-
-fn main() {
- let r: () = Builder::new()
- .name("owned name".to_string())
- .spawn(move || {
- panic!("test");
- ()
- })
- .unwrap()
- .join()
- .unwrap();
- panic!();
-}
diff --git a/src/test/ui/panics/panic.rs b/src/test/ui/panics/panic.rs
deleted file mode 100644
index b6227a582..000000000
--- a/src/test/ui/panics/panic.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-// run-fail
-// error-pattern:1 == 2
-// ignore-emscripten no processes
-
-fn main() {
- assert!(1 == 2);
-}
diff --git a/src/test/ui/panics/result-get-panic.rs b/src/test/ui/panics/result-get-panic.rs
deleted file mode 100644
index 461f30b91..000000000
--- a/src/test/ui/panics/result-get-panic.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// run-fail
-// error-pattern:called `Result::unwrap()` on an `Err` value
-// ignore-emscripten no processes
-
-use std::result::Result::Err;
-
-fn main() {
- println!("{}", Err::<isize, String>("kitty".to_string()).unwrap());
-}
diff --git a/src/test/ui/panics/runtime-switch.legacy.run.stderr b/src/test/ui/panics/runtime-switch.legacy.run.stderr
deleted file mode 100644
index 0f7655163..000000000
--- a/src/test/ui/panics/runtime-switch.legacy.run.stderr
+++ /dev/null
@@ -1,5 +0,0 @@
-thread 'main' panicked at 'explicit panic', $DIR/runtime-switch.rs:26:5
-stack backtrace:
- 0: std::panicking::begin_panic
- 1: runtime_switch::main
-note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
diff --git a/src/test/ui/panics/runtime-switch.rs b/src/test/ui/panics/runtime-switch.rs
deleted file mode 100644
index 882340e49..000000000
--- a/src/test/ui/panics/runtime-switch.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Test for std::panic::set_backtrace_style.
-
-// compile-flags: -O
-// compile-flags:-Cstrip=none
-// run-fail
-// check-run-results
-// exec-env:RUST_BACKTRACE=0
-
-// ignore-msvc see #62897 and `backtrace-debuginfo.rs` test
-// ignore-android FIXME #17520
-// ignore-openbsd no support for libbacktrace without filename
-// ignore-wasm no panic or subprocess support
-// ignore-emscripten no panic or subprocess support
-// ignore-sgx no subprocess support
-// ignore-fuchsia Backtrace not symbolized
-
-// NOTE(eddyb) output differs between symbol mangling schemes
-// revisions: legacy v0
-// [legacy] compile-flags: -Zunstable-options -Csymbol-mangling-version=legacy
-// [v0] compile-flags: -Csymbol-mangling-version=v0
-
-#![feature(panic_backtrace_config)]
-
-fn main() {
- std::panic::set_backtrace_style(std::panic::BacktraceStyle::Short);
- panic!()
-}
diff --git a/src/test/ui/panics/runtime-switch.v0.run.stderr b/src/test/ui/panics/runtime-switch.v0.run.stderr
deleted file mode 100644
index a4ae44131..000000000
--- a/src/test/ui/panics/runtime-switch.v0.run.stderr
+++ /dev/null
@@ -1,5 +0,0 @@
-thread 'main' panicked at 'explicit panic', $DIR/runtime-switch.rs:26:5
-stack backtrace:
- 0: std::panicking::begin_panic::<&str>
- 1: runtime_switch::main
-note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
diff --git a/src/test/ui/panics/test-panic.rs b/src/test/ui/panics/test-panic.rs
deleted file mode 100644
index 85c9279cd..000000000
--- a/src/test/ui/panics/test-panic.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// run-fail
-// check-stdout
-// compile-flags: --test
-// ignore-emscripten
-
-#[test]
-fn test_foo() {
- panic!()
-}
diff --git a/src/test/ui/panics/test-should-fail-bad-message.rs b/src/test/ui/panics/test-should-fail-bad-message.rs
deleted file mode 100644
index 701f26776..000000000
--- a/src/test/ui/panics/test-should-fail-bad-message.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// run-fail
-// check-stdout
-// compile-flags: --test
-// ignore-emscripten
-
-#[test]
-#[should_panic(expected = "foobar")]
-fn test_foo() {
- panic!("blah")
-}
diff --git a/src/test/ui/panics/test-should-panic-bad-message.rs b/src/test/ui/panics/test-should-panic-bad-message.rs
deleted file mode 100644
index a82c4e144..000000000
--- a/src/test/ui/panics/test-should-panic-bad-message.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// run-fail
-// compile-flags: --test
-// check-stdout
-// ignore-emscripten no processes
-
-#[test]
-#[should_panic(expected = "foo")]
-pub fn test_bar() {
- panic!("bar")
-}
diff --git a/src/test/ui/panics/test-should-panic-no-message.rs b/src/test/ui/panics/test-should-panic-no-message.rs
deleted file mode 100644
index 13f67a41c..000000000
--- a/src/test/ui/panics/test-should-panic-no-message.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// run-fail
-// compile-flags: --test
-// check-stdout
-// ignore-emscripten no processes
-
-#[test]
-#[should_panic(expected = "foo")]
-pub fn test_explicit() {
- panic!()
-}
diff --git a/src/test/ui/panics/unique-panic.rs b/src/test/ui/panics/unique-panic.rs
deleted file mode 100644
index ae7911e59..000000000
--- a/src/test/ui/panics/unique-panic.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// run-fail
-// error-pattern: panic
-// for some reason, fails to match error string on
-// wasm32-unknown-unknown with stripped debuginfo and symbols,
-// so don't strip it
-// compile-flags:-Cstrip=none
-
-fn main() {
- Box::new(panic!());
-}
diff --git a/src/test/ui/panics/while-body-panics.rs b/src/test/ui/panics/while-body-panics.rs
deleted file mode 100644
index 2c05eb389..000000000
--- a/src/test/ui/panics/while-body-panics.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-#![allow(while_true)]
-
-// run-fail
-// error-pattern:quux
-// ignore-emscripten no processes
-
-fn main() {
- let _x: isize = {
- while true {
- panic!("quux");
- }
- 8
- };
-}
diff --git a/src/test/ui/panics/while-panic.rs b/src/test/ui/panics/while-panic.rs
deleted file mode 100644
index 3c6ee8fa3..000000000
--- a/src/test/ui/panics/while-panic.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-#![allow(while_true)]
-
-// run-fail
-// error-pattern:giraffe
-// ignore-emscripten no processes
-
-fn main() {
- panic!("{}", {
- while true {
- panic!("giraffe")
- }
- "clandestine"
- });
-}