mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
15 lines
363 B
Rust
15 lines
363 B
Rust
#![feature(thread_local)]
|
|
|
|
#[thread_local]
|
|
static FOO: u8 = 3;
|
|
|
|
fn main() {
|
|
let a = &FOO;
|
|
//~^ ERROR thread-local variable borrowed past end of function
|
|
//~| NOTE thread-local variables cannot be borrowed beyond the end of the function
|
|
|
|
std::thread::spawn(move || {
|
|
println!("{}", a);
|
|
});
|
|
}
|
|
//~^ NOTE end of enclosing function is here
|