]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-30018-panic.rs
Merge commit '97e504549371d7640cf011d266e3c17394fdddac' into sync_cg_clif-2021-12-20
[rust.git] / src / test / ui / issues / issue-30018-panic.rs
1 // run-pass
2 // Regression test for Issue #30018. This is very similar to the
3 // original reported test, except that the panic is wrapped in a
4 // spawned thread to isolate the expected error result from the
5 // SIGTRAP injected by the drop-flag consistency checking.
6
7 // needs-unwind
8 // ignore-emscripten no threads support
9
10 struct Foo;
11
12 impl Drop for Foo {
13     fn drop(&mut self) {}
14 }
15
16 fn foo() -> Foo {
17     panic!();
18 }
19
20 fn main() {
21     use std::thread;
22     let handle = thread::spawn(|| {
23         let _ = &[foo()];
24     });
25     let _ = handle.join();
26 }