Skip to content

Commit

Permalink
Add test for issue #37508
Browse files Browse the repository at this point in the history
  • Loading branch information
marmeladema committed Apr 24, 2021
1 parent e11a9fa commit cbd647f
Showing 1 changed file with 22 additions and 0 deletions.
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,
}

0 comments on commit cbd647f

Please sign in to comment.