2021-06-01 05:59:17 +00:00
|
|
|
// edition:2018
|
2023-10-26 15:33:41 +00:00
|
|
|
// revisions: mir thir
|
|
|
|
//thir: -Zthir-unsafeck
|
2021-06-01 05:59:17 +00:00
|
|
|
|
|
|
|
#![feature(thread_local)]
|
|
|
|
#![feature(const_swap)]
|
2023-10-26 15:33:41 +00:00
|
|
|
|
2021-06-01 05:59:17 +00:00
|
|
|
#[thread_local]
|
|
|
|
static mut STATIC_VAR_2: [u32; 8] = [4; 8];
|
|
|
|
const fn g(x: &mut [u32; 8]) {
|
|
|
|
//~^ ERROR mutable references are not allowed
|
|
|
|
std::mem::swap(x, &mut STATIC_VAR_2)
|
|
|
|
//~^ ERROR thread-local statics cannot be accessed
|
|
|
|
//~| ERROR mutable references are not allowed
|
|
|
|
//~| ERROR use of mutable static is unsafe
|
2021-06-01 14:05:04 +00:00
|
|
|
//~| constant functions cannot refer to statics
|
2021-06-01 05:59:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|