summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-17954.rs
blob: eb6a3d70f58e23fcc55642c022eeb98145d997af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#![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