diff options
Diffstat (limited to 'tests/ui/consts/const-address-of-mut.rs')
-rw-r--r-- | tests/ui/consts/const-address-of-mut.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/consts/const-address-of-mut.rs b/tests/ui/consts/const-address-of-mut.rs new file mode 100644 index 000000000..3788088b8 --- /dev/null +++ b/tests/ui/consts/const-address-of-mut.rs @@ -0,0 +1,14 @@ +#![feature(raw_ref_op)] + +const A: () = { let mut x = 2; &raw mut x; }; //~ mutable reference + +static B: () = { let mut x = 2; &raw mut x; }; //~ mutable reference + +static mut C: () = { let mut x = 2; &raw mut x; }; //~ mutable reference + +const fn foo() { + let mut x = 0; + let y = &raw mut x; //~ mutable reference +} + +fn main() {} |