From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- .../tls-dtors-are-run-in-a-static-binary.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/test/ui/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs (limited to 'src/test/ui/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs') diff --git a/src/test/ui/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs b/src/test/ui/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs new file mode 100644 index 000000000..8baef4334 --- /dev/null +++ b/src/test/ui/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs @@ -0,0 +1,22 @@ +// run-pass +// no-prefer-dynamic +// ignore-emscripten no threads support + +static mut HIT: bool = false; + +struct Foo; + +impl Drop for Foo { + fn drop(&mut self) { + unsafe { HIT = true; } + } +} + +thread_local!(static FOO: Foo = Foo); + +fn main() { + std::thread::spawn(|| { + FOO.with(|_| {}); + }).join().unwrap(); + assert!(unsafe { HIT }); +} -- cgit v1.2.3