]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0712.md
Rollup merge of #92310 - ehuss:rustdoc-ice, r=estebank
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0712.md
1 A borrow of a thread-local variable was made inside a function which outlived
2 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 ```