rust/tests/ui/consts/const-address-of-interior-mut.rs
2024-09-15 10:20:47 +02:00

16 lines
295 B
Rust

//@check-pass
use std::cell::Cell;
const A: () = { let x = Cell::new(2); &raw const x; };
static B: () = { let x = Cell::new(2); &raw const x; };
static mut C: () = { let x = Cell::new(2); &raw const x; };
const fn foo() {
let x = Cell::new(0);
let y = &raw const x;
}
fn main() {}