We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0a8629b commit a89c7e1Copy full SHA for a89c7e1
src/test/ui/thread-local/thread-local-issue-37508.rs
@@ -0,0 +1,36 @@
1
+// only-x86_64
2
+// compile-flags: -Ccode-model=large --crate-type lib
3
+// build-pass
4
+//
5
+// Regression test for issue #37508
6
+
7
+#![no_main]
8
+#![no_std]
9
+#![feature(thread_local, lang_items)]
10
11
+#[lang = "eh_personality"]
12
+extern "C" fn eh_personality() {}
13
14
+use core::panic::PanicInfo;
15
16
+#[panic_handler]
17
+fn panic(_panic: &PanicInfo<'_>) -> ! {
18
+ loop {}
19
+}
20
21
+pub struct BB;
22
23
+#[thread_local]
24
+static mut KEY: Key = Key { inner: BB, dtor_running: false };
25
26
+pub unsafe fn set() -> Option<&'static BB> {
27
+ if KEY.dtor_running {
28
+ return None;
29
+ }
30
+ Some(&KEY.inner)
31
32
33
+pub struct Key {
34
+ inner: BB,
35
+ dtor_running: bool,
36
0 commit comments