Skip to content

Commit a89c7e1

Browse files
committed
add regression test for issue #37508
1 parent 0a8629b commit a89c7e1

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)