rust/tests/ui/thread-local/tls.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
312 B
Rust
Raw Normal View History

// run-pass
// ignore-emscripten no threads support
2020-06-10 16:11:17 -05:00
// compile-flags: -O
#![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);
}