Skip to content

Commit

Permalink
Rollup merge of rust-lang#84508 - marmeladema:test-thread-local-issue…
Browse files Browse the repository at this point in the history
…-37508, r=Mark-Simulacrum

Add test for thread-local and code-model=large

Closes rust-lang#37508
  • Loading branch information
m-ou-se authored Apr 28, 2021
2 parents 6d6bbfc + cbd647f commit fadb8f0
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 fadb8f0

Please sign in to comment.