]> git.lizzy.rs Git - rust.git/blob - src/test/ui/thread-local-static.rs
Rollup merge of #93112 - pietroalbini:pa-cve-2022-21658-nightly, r=pietroalbini
[rust.git] / src / test / 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() {}