]> git.lizzy.rs Git - rust.git/blob - tests/ui/thread-local-static.rs
Rollup merge of #107442 - lukas-code:slice-panics, r=cuviper
[rust.git] / tests / ui / thread-local-static.rs
1 // edition:2018
2
3 #![feature(thread_local)]
4 #![feature(const_swap)]
5 #[thread_local]
6 static mut STATIC_VAR_2: [u32; 8] = [4; 8];
7 const fn g(x: &mut [u32; 8]) {
8     //~^ ERROR mutable references are not allowed
9     std::mem::swap(x, &mut STATIC_VAR_2)
10     //~^ ERROR thread-local statics cannot be accessed
11     //~| ERROR mutable references are not allowed
12     //~| ERROR use of mutable static is unsafe
13     //~| constant functions cannot refer to statics
14 }
15
16 fn main() {}