]>
Commit | Line | Data |
---|---|---|
f035d41b XL |
1 | A borrow of a thread-local variable was made inside a function which outlived |
2 | the lifetime of the function. | |
60c5eb7d XL |
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 | ``` |