about summary refs log tree commit diff
path: root/tests/ui/panics/catch-unwind-bang.rs
diff options
context:
space:
mode:
authormejrs <59372212+mejrs@users.noreply.github.com>2025-04-29 18:19:26 +0200
committermejrs <59372212+mejrs@users.noreply.github.com>2025-04-29 18:19:26 +0200
commita917de445bfb26e1e9f2b9b9f99c04426606d017 (patch)
treece67e159057dc5e83a01147b9a57724a77034777 /tests/ui/panics/catch-unwind-bang.rs
parent1f2b71e072d85dd2ecfd0e60da426e80b05e5f9b (diff)
downloadrust-a917de445bfb26e1e9f2b9b9f99c04426606d017.tar.gz
rust-a917de445bfb26e1e9f2b9b9f99c04426606d017.zip
Move tests from /ui directory
Diffstat (limited to 'tests/ui/panics/catch-unwind-bang.rs')
-rw-r--r--tests/ui/panics/catch-unwind-bang.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/panics/catch-unwind-bang.rs b/tests/ui/panics/catch-unwind-bang.rs
new file mode 100644
index 00000000000..80eb377e5ca
--- /dev/null
+++ b/tests/ui/panics/catch-unwind-bang.rs
@@ -0,0 +1,15 @@
+//! Check that the unwind machinery handles uninhabited types correctly.
+//! It used to call `std::mem::uninitialized::<!>();` at some point...
+//!
+//! See <https://github.com/rust-lang/rust/issues/39432>
+
+//@ run-pass
+//@ needs-unwind
+
+fn worker() -> ! {
+    panic!()
+}
+
+fn main() {
+    std::panic::catch_unwind(worker).unwrap_err();
+}