]> git.proxmox.com Git - rustc.git/blob - src/test/run-pass/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs
New upstream version 1.37.0+dfsg1
[rustc.git] / src / test / run-pass / threads-sendsync / tls-dtors-are-run-in-a-static-binary.rs
1 // run-pass
2 // no-prefer-dynamic
3 // ignore-emscripten no threads support
4
5 static mut HIT: bool = false;
6
7 struct Foo;
8
9 impl Drop for Foo {
10 fn drop(&mut self) {
11 unsafe { HIT = true; }
12 }
13 }
14
15 thread_local!(static FOO: Foo = Foo);
16
17 fn main() {
18 std::thread::spawn(|| {
19 FOO.with(|_| {});
20 }).join().unwrap();
21 assert!(unsafe { HIT });
22 }