Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/test/ui/thread-local-issue-37508.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// compile-flags: --crate-type rlib -C opt-level=3 -C code-model=large
// build-pass

#![no_std]
#![feature(thread_local)]

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,
}