2021-06-01 13:59:17 +08:00
|
|
|
//@ edition:2018
|
|
|
|
|
|
|
|
#![feature(thread_local)]
|
|
|
|
#![feature(const_swap)]
|
2024-02-17 22:01:56 +03:00
|
|
|
#![allow(static_mut_refs)]
|
2023-10-26 15:33:41 +00:00
|
|
|
|
2021-06-01 13:59:17 +08:00
|
|
|
#[thread_local]
|
|
|
|
static mut STATIC_VAR_2: [u32; 8] = [4; 8];
|
|
|
|
const fn g(x: &mut [u32; 8]) {
|
|
|
|
std::mem::swap(x, &mut STATIC_VAR_2)
|
2024-02-12 15:14:58 +01:00
|
|
|
//~^ ERROR thread-local statics cannot be accessed
|
2021-06-01 13:59:17 +08:00
|
|
|
//~| ERROR use of mutable static is unsafe
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|