2017-08-08 10:22:51 -05:00
|
|
|
#![feature(thread_local)]
|
|
|
|
|
|
|
|
#[thread_local]
|
|
|
|
static FOO: u8 = 3;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let a = &FOO;
|
2019-04-22 02:40:08 -05: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 10:22:51 -05:00
|
|
|
|
|
|
|
std::thread::spawn(move || {
|
|
|
|
println!("{}", a);
|
|
|
|
});
|
2017-12-11 11:29:31 -06:00
|
|
|
}
|
2019-04-22 02:40:08 -05:00
|
|
|
//~^ NOTE end of enclosing function is here
|