rust/tests/ui/consts/const-address-of-interior-mut.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
295 B
Rust
Raw Normal View History

2024-08-26 12:51:16 +00:00
//@check-pass
2019-09-18 20:31:25 +00:00
use std::cell::Cell;
2024-08-26 12:51:16 +00:00
const A: () = { let x = Cell::new(2); &raw const x; };
2019-09-18 20:31:25 +00:00
2024-08-26 12:51:16 +00:00
static B: () = { let x = Cell::new(2); &raw const x; };
2019-09-18 20:31:25 +00:00
2024-08-26 12:51:16 +00:00
static mut C: () = { let x = Cell::new(2); &raw const x; };
2019-09-18 20:31:25 +00:00
const fn foo() {
let x = Cell::new(0);
2024-08-26 12:51:16 +00:00
let y = &raw const x;
2019-09-18 20:31:25 +00:00
}
fn main() {}