]> git.proxmox.com Git - rustc.git/blame - src/test/ui/error-codes/E0388.stderr
New upstream version 1.51.0+dfsg1
[rustc.git] / src / test / ui / error-codes / E0388.stderr
CommitLineData
1b1a35ee 1warning: taking a mutable reference to a `const` item
0731742a 2 --> $DIR/E0388.rs:4:30
2c00a5a8 3 |
532ac7d7 4LL | const CR: &'static mut i32 = &mut C;
1b1a35ee 5 | ^^^^^^
a1dfa0c6 6 |
1b1a35ee
XL
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
10note: `const` item defined here
11 --> $DIR/E0388.rs:2:1
f9f354fc 12 |
1b1a35ee
XL
13LL | const C: i32 = 2;
14 | ^^^^^^^^^^^^^^^^^
15
5869c6ff 16error[E0764]: mutable references are not allowed in the final value of constants
1b1a35ee
XL
17 --> $DIR/E0388.rs:4:30
18 |
19LL | const CR: &'static mut i32 = &mut C;
5869c6ff 20 | ^^^^^^
a1dfa0c6 21
5869c6ff 22error[E0658]: mutation through a reference is not allowed in statics
1b1a35ee 23 --> $DIR/E0388.rs:6:39
2c00a5a8 24 |
532ac7d7 25LL | static STATIC_REF: &'static mut i32 = &mut X;
5869c6ff
XL
26 | ^^^^^^
27 |
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
30
31error[E0764]: mutable references are not allowed in the final value of statics
32 --> $DIR/E0388.rs:6:39
33 |
34LL | static STATIC_REF: &'static mut i32 = &mut X;
35 | ^^^^^^
2c00a5a8 36
48663c56 37error[E0596]: cannot borrow immutable static item `X` as mutable
1b1a35ee 38 --> $DIR/E0388.rs:6:39
2c00a5a8 39 |
532ac7d7 40LL | static STATIC_REF: &'static mut i32 = &mut X;
48663c56 41 | ^^^^^^ cannot borrow as mutable
2c00a5a8 42
1b1a35ee 43warning: taking a mutable reference to a `const` item
5869c6ff 44 --> $DIR/E0388.rs:10:38
1b1a35ee
XL
45 |
46LL | static CONST_REF: &'static mut i32 = &mut C;
47 | ^^^^^^
48 |
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
51note: `const` item defined here
52 --> $DIR/E0388.rs:2:1
53 |
54LL | const C: i32 = 2;
55 | ^^^^^^^^^^^^^^^^^
56
5869c6ff
XL
57error[E0764]: mutable references are not allowed in the final value of statics
58 --> $DIR/E0388.rs:10:38
2c00a5a8 59 |
532ac7d7 60LL | static CONST_REF: &'static mut i32 = &mut C;
5869c6ff 61 | ^^^^^^
2c00a5a8 62
5869c6ff 63error: aborting due to 5 previous errors; 2 warnings emitted
2c00a5a8 64
5869c6ff 65Some errors have detailed explanations: E0596, E0658, E0764.
1b1a35ee 66For more information about an error, try `rustc --explain E0596`.