Auto merge of #86352 - yerke:add-test-for-issue-37508, r=Mark-Simulacrum
Add regression test for issue #37508 Add regression test for issue #37508 Closes #37508 Took this test from #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.
This commit is contained in:
commit
c38111c4fb
1 changed files with 36 additions and 0 deletions
36
src/test/ui/thread-local/thread-local-issue-37508.rs
Normal file
36
src/test/ui/thread-local/thread-local-issue-37508.rs
Normal file
|
@ -0,0 +1,36 @@
|
|||
// only-x86_64
|
||||
// compile-flags: -Ccode-model=large --crate-type lib
|
||||
// build-pass
|
||||
//
|
||||
// Regression test for issue #37508
|
||||
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
#![feature(thread_local, lang_items)]
|
||||
|
||||
#[lang = "eh_personality"]
|
||||
extern "C" fn eh_personality() {}
|
||||
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(_panic: &PanicInfo<'_>) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
pub struct BB;
|
||||
|
||||
#[thread_local]
|
||||
static mut KEY: Key = Key { inner: BB, dtor_running: false };
|
||||
|
||||
pub unsafe fn set() -> Option<&'static BB> {
|
||||
if KEY.dtor_running {
|
||||
return None;
|
||||
}
|
||||
Some(&KEY.inner)
|
||||
}
|
||||
|
||||
pub struct Key {
|
||||
inner: BB,
|
||||
dtor_running: bool,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue