]> git.lizzy.rs Git - rust.git/blob - src/test/ui/thread-local-in-ctfe.rs
Auto merge of #60065 - QuietMisdreavus:async-move-doctests, r=ollie27
[rust.git] / src / test / ui / thread-local-in-ctfe.rs
1 #![feature(const_fn, thread_local)]
2
3 #[thread_local]
4 static A: u32 = 1;
5
6 static B: u32 = A;
7 //~^ ERROR thread-local statics cannot be accessed at compile-time
8
9 static C: &u32 = &A;
10 //~^ ERROR thread-local statics cannot be accessed at compile-time
11 //~| WARNING thread-local variable borrowed past end of function
12 //~| WARNING this error has been downgraded to a warning
13 //~| WARNING this warning will become a hard error in the future
14
15 const D: u32 = A;
16 //~^ ERROR thread-local statics cannot be accessed at compile-time
17
18 const E: &u32 = &A;
19 //~^ ERROR thread-local statics cannot be accessed at compile-time
20 //~| WARNING thread-local variable borrowed past end of function
21 //~| WARNING this error has been downgraded to a warning
22 //~| WARNING this warning will become a hard error in the future
23
24 const fn f() -> u32 {
25     A
26     //~^ ERROR thread-local statics cannot be accessed at compile-time
27 }
28
29 fn main() {}