]> git.proxmox.com Git - rustc.git/blame - tests/ui/thread-local-static.rs
New upstream version 1.69.0+dfsg1
[rustc.git] / tests / ui / thread-local-static.rs
CommitLineData
17df50a5
XL
1// edition:2018
2
3#![feature(thread_local)]
4#![feature(const_swap)]
5#[thread_local]
6static mut STATIC_VAR_2: [u32; 8] = [4; 8];
7const 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
17df50a5
XL
14}
15
16fn main() {}