]> git.lizzy.rs Git - rust.git/blob - src/test/ui/error-codes/E0017.rs
Merge commit 'd3a2366ee877075c59b38bd8ced55f224fc7ef51' into sync_cg_clif-2022-07-26
[rust.git] / src / test / ui / error-codes / E0017.rs
1 static X: i32 = 1;
2 const C: i32 = 2;
3 static mut M: i32 = 3;
4
5 const CR: &'static mut i32 = &mut C; //~ ERROR mutable references are not allowed
6                                      //~| WARN taking a mutable
7 static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0658
8                                               //~| ERROR cannot borrow
9                                               //~| ERROR mutable references are not allowed
10
11 static CONST_REF: &'static mut i32 = &mut C; //~ ERROR mutable references are not allowed
12                                               //~| WARN taking a mutable
13 static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; //~ ERROR mutable references are not
14 fn main() {}