about summary refs log tree commit diff
path: root/tests/ui/thread-local/tls.rs
blob: fa6a722b291d717872922802e0016d34b670fbcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//@ run-pass
//@ needs-threads
//@ compile-flags: -O
//@ ignore-nto Doesn't work without emulated TLS enabled (in LLVM)

#![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);
}