]> git.proxmox.com Git - rustc.git/blame - src/librustc_error_codes/error_codes/E0712.md
New upstream version 1.47.0+dfsg1
[rustc.git] / src / librustc_error_codes / error_codes / E0712.md
CommitLineData
f035d41b
XL
1A borrow of a thread-local variable was made inside a function which outlived
2the lifetime of the function.
60c5eb7d
XL
3
4Erroneous code example:
5
6```compile_fail,E0712
7#![feature(thread_local)]
8
9#[thread_local]
10static FOO: u8 = 3;
11
12fn 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```