]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-25089.rs
point at private fields in struct literal
[rust.git] / src / test / ui / issues / issue-25089.rs
1 // run-pass
2 // needs-unwind
3 // ignore-emscripten no threads support
4
5 use std::thread;
6
7 struct Foo(i32);
8
9 impl Drop for Foo {
10     fn drop(&mut self) {
11         static mut DROPPED: bool = false;
12         unsafe {
13             assert!(!DROPPED);
14             DROPPED = true;
15         }
16     }
17 }
18
19 struct Empty;
20
21 fn empty() -> Empty { Empty }
22
23 fn should_panic(_: Foo, _: Empty) {
24     panic!("test panic");
25 }
26
27 fn test() {
28     should_panic(Foo(1), empty());
29 }
30
31 fn main() {
32     let ret = thread::spawn(test).join();
33     assert!(ret.is_err());
34 }