diff options
Diffstat (limited to 'tests/ui/issues/issue-17954.rs')
-rw-r--r-- | tests/ui/issues/issue-17954.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/issues/issue-17954.rs b/tests/ui/issues/issue-17954.rs new file mode 100644 index 000000000..eb6a3d70f --- /dev/null +++ b/tests/ui/issues/issue-17954.rs @@ -0,0 +1,15 @@ +#![feature(thread_local)] + +#[thread_local] +static FOO: u8 = 3; + +fn main() { + let a = &FOO; + //~^ ERROR thread-local variable borrowed past end of function + //~| NOTE thread-local variables cannot be borrowed beyond the end of the function + + std::thread::spawn(move || { + println!("{}", a); + }); +} +//~^ NOTE end of enclosing function is here |