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

15 lines
392 B
Rust
Raw Normal View History

2019-09-18 15:31:25 -05:00
#![feature(raw_ref_op)]
2020-10-01 13:03:52 -05:00
const A: () = { let mut x = 2; &raw mut x; }; //~ mutable reference
2019-09-18 15:31:25 -05:00
2020-10-01 13:03:52 -05:00
static B: () = { let mut x = 2; &raw mut x; }; //~ mutable reference
2019-09-18 15:31:25 -05:00
2020-10-01 13:03:52 -05:00
static mut C: () = { let mut x = 2; &raw mut x; }; //~ mutable reference
2019-09-18 15:31:25 -05:00
const fn foo() {
let mut x = 0;
2020-10-01 13:03:52 -05:00
let y = &raw mut x; //~ mutable reference
2019-09-18 15:31:25 -05:00
}
fn main() {}