1 warning: taking a mutable reference to a `const` item
4 LL | const CR: &'static mut i32 = &mut C;
7 = note: `#[warn(const_item_mutation)]` on by default
8 = note: each usage of a `const` item creates a new temporary
9 = note: the mutable reference will refer to this temporary, not the original `const` item
10 note: `const` item defined here
13 LL | const C: i32 = 2;
16 error[E0764]: mutable references are not allowed in the final value of constants
17 --> $DIR/E0017.rs:5:30
19 LL | const CR: &'static mut i32 = &mut C;
22 error[E0658]: mutation through a reference is not allowed in statics
23 --> $DIR/E0017.rs:7:39
25 LL | static STATIC_REF: &'static mut i32 = &mut X;
28 = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
29 = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
31 error[E0764]: mutable references are not allowed in the final value of statics
32 --> $DIR/E0017.rs:7:39
34 LL | static STATIC_REF: &'static mut i32 = &mut X;
37 error[E0596]: cannot borrow immutable static item `X` as mutable
38 --> $DIR/E0017.rs:7:39
40 LL | static STATIC_REF: &'static mut i32 = &mut X;
41 | ^^^^^^ cannot borrow as mutable
43 warning: taking a mutable reference to a `const` item
44 --> $DIR/E0017.rs:11:38
46 LL | static CONST_REF: &'static mut i32 = &mut C;
49 = note: each usage of a `const` item creates a new temporary
50 = note: the mutable reference will refer to this temporary, not the original `const` item
51 note: `const` item defined here
54 LL | const C: i32 = 2;
57 error[E0764]: mutable references are not allowed in the final value of statics
58 --> $DIR/E0017.rs:11:38
60 LL | static CONST_REF: &'static mut i32 = &mut C;
63 error[E0764]: mutable references are not allowed in the final value of statics
64 --> $DIR/E0017.rs:13:52
66 LL | static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M };
69 error: aborting due to 6 previous errors; 2 warnings emitted
71 Some errors have detailed explanations: E0596, E0658, E0764.
72 For more information about an error, try `rustc --explain E0596`.