2020-06-06 18:26:15 +01:00
|
|
|
// run-pass
|
2020-06-13 13:24:19 +01:00
|
|
|
// ignore-emscripten no threads support
|
2020-06-10 22:11:17 +01:00
|
|
|
// compile-flags: -O
|
2023-01-10 10:44:05 +01:00
|
|
|
// ignore-nto Doesn't work without emulated TLS enabled (in LLVM)
|
2020-06-06 18:26:15 +01:00
|
|
|
|
|
|
|
#![feature(thread_local)]
|
|
|
|
|
|
|
|
#[thread_local]
|
|
|
|
static S: u32 = 222;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let local = &S as *const u32 as usize;
|
|
|
|
let foreign = std::thread::spawn(|| &S as *const u32 as usize).join().unwrap();
|
|
|
|
assert_ne!(local, foreign);
|
|
|
|
}
|