Skip to content

Commit fadb8f0

Browse files
authored
Rollup merge of rust-lang#84508 - marmeladema:test-thread-local-issue-37508, r=Mark-Simulacrum
Add test for thread-local and code-model=large Closes rust-lang#37508
2 parents 6d6bbfc + cbd647f commit fadb8f0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// compile-flags: --crate-type rlib -C opt-level=3 -C code-model=large
2+
// build-pass
3+
4+
#![no_std]
5+
#![feature(thread_local)]
6+
7+
pub struct BB;
8+
9+
#[thread_local]
10+
static mut KEY: Key = Key { inner: BB, dtor_running: false };
11+
12+
pub unsafe fn set() -> Option<&'static BB> {
13+
if KEY.dtor_running {
14+
return None;
15+
}
16+
Some(&KEY.inner)
17+
}
18+
19+
pub struct Key {
20+
inner: BB,
21+
dtor_running: bool,
22+
}

0 commit comments

Comments
 (0)