Skip to content

Commit 16a12c2

Browse files
authored
Rollup merge of rust-lang#86352 - yerke:add-test-for-issue-37508, r=Mark-Simulacrum
Add regression test for issue rust-lang#37508 Add regression test for issue rust-lang#37508 Closes rust-lang#37508 Took this test from rust-lang#37508 and updated the panic handler to the modern standard. r? `@Mark-Simulacrum` Mark, I hope you don't me tagging you here. You were involved in the original issue and I hope you might be more comfortable reviewing this.
2 parents 4e1e6d8 + a89c7e1 commit 16a12c2

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)