diff options
Diffstat (limited to '')
-rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0712.md | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0712.md b/compiler/rustc_error_codes/src/error_codes/E0712.md new file mode 100644 index 000000000..7e09210e7 --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0712.md @@ -0,0 +1,19 @@ +A borrow of a thread-local variable was made inside a function which outlived +the lifetime of the function. + +Erroneous code example: + +```compile_fail,E0712 +#![feature(thread_local)] + +#[thread_local] +static FOO: u8 = 3; + +fn main() { + let a = &FOO; // error: thread-local variable borrowed past end of function + + std::thread::spawn(move || { + println!("{}", a); + }); +} +``` |