]> git.lizzy.rs Git - rust.git/blob - src/test/ui/thread-local-in-ctfe.rs
Rollup merge of #53218 - weiznich:feature/option_ref_into, r=KodrAus
[rust.git] / src / test / ui / thread-local-in-ctfe.rs
1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #![feature(const_fn, thread_local)]
12
13 #[thread_local]
14 static A: u32 = 1;
15
16 static B: u32 = A;
17 //~^ ERROR thread-local statics cannot be accessed at compile-time
18
19 static C: &u32 = &A;
20 //~^ ERROR thread-local statics cannot be accessed at compile-time
21
22 const D: u32 = A;
23 //~^ ERROR thread-local statics cannot be accessed at compile-time
24
25 const E: &u32 = &A;
26 //~^ ERROR thread-local statics cannot be accessed at compile-time
27
28 const fn f() -> u32 {
29     A
30     //~^ ERROR thread-local statics cannot be accessed at compile-time
31 }
32
33 fn main() {}