2017-08-08 18:22:51 +03:00
|
|
|
#![feature(thread_local)]
|
|
|
|
|
|
|
|
|
|
#[thread_local]
|
|
|
|
|
static FOO: u8 = 3;
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
let a = &FOO;
|
2019-04-22 08:40:08 +01:00
|
|
|
//~^ ERROR thread-local variable borrowed past end of function
|
|
|
|
|
//~| NOTE thread-local variables cannot be borrowed beyond the end of the function
|
2017-08-08 18:22:51 +03:00
|
|
|
|
|
|
|
|
std::thread::spawn(move || {
|
|
|
|
|
println!("{}", a);
|
|
|
|
|
});
|
2017-12-11 17:29:31 +00:00
|
|
|
}
|
2019-04-22 08:40:08 +01:00
|
|
|
//~^ NOTE end of enclosing function is here
|