]> git.proxmox.com Git - rustc.git/blob - src/librustc_error_codes/error_codes/E0712.md
New upstream version 1.41.1+dfsg1
[rustc.git] / src / librustc_error_codes / error_codes / E0712.md
1 This error occurs because a borrow of a thread-local variable was made inside a
2 function which outlived the lifetime of the function.
3
4 Erroneous code example:
5
6 ```compile_fail,E0712
7 #![feature(thread_local)]
8
9 #[thread_local]
10 static FOO: u8 = 3;
11
12 fn main() {
13 let a = &FOO; // error: thread-local variable borrowed past end of function
14
15 std::thread::spawn(move || {
16 println!("{}", a);
17 });
18 }
19 ```