]> git.proxmox.com Git - rustc.git/blob - src/test/ui/error-codes/E0388.stderr
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / ui / error-codes / E0388.stderr
1 warning: taking a mutable reference to a `const` item
2 --> $DIR/E0388.rs:4:30
3 |
4 LL | const CR: &'static mut i32 = &mut C;
5 | ^^^^^^
6 |
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
11 --> $DIR/E0388.rs:2:1
12 |
13 LL | const C: i32 = 2;
14 | ^^^^^^^^^^^^^^^^^
15
16 error[E0764]: mutable references are not allowed in constants
17 --> $DIR/E0388.rs:4:30
18 |
19 LL | const CR: &'static mut i32 = &mut C;
20 | ^^^^^^ `&mut` is only allowed in `const fn`
21
22 error[E0764]: mutable references are not allowed in statics
23 --> $DIR/E0388.rs:6:39
24 |
25 LL | static STATIC_REF: &'static mut i32 = &mut X;
26 | ^^^^^^ `&mut` is only allowed in `const fn`
27
28 error[E0596]: cannot borrow immutable static item `X` as mutable
29 --> $DIR/E0388.rs:6:39
30 |
31 LL | static STATIC_REF: &'static mut i32 = &mut X;
32 | ^^^^^^ cannot borrow as mutable
33
34 warning: taking a mutable reference to a `const` item
35 --> $DIR/E0388.rs:9:38
36 |
37 LL | static CONST_REF: &'static mut i32 = &mut C;
38 | ^^^^^^
39 |
40 = note: each usage of a `const` item creates a new temporary
41 = note: the mutable reference will refer to this temporary, not the original `const` item
42 note: `const` item defined here
43 --> $DIR/E0388.rs:2:1
44 |
45 LL | const C: i32 = 2;
46 | ^^^^^^^^^^^^^^^^^
47
48 error[E0764]: mutable references are not allowed in statics
49 --> $DIR/E0388.rs:9:38
50 |
51 LL | static CONST_REF: &'static mut i32 = &mut C;
52 | ^^^^^^ `&mut` is only allowed in `const fn`
53
54 error: aborting due to 4 previous errors; 2 warnings emitted
55
56 Some errors have detailed explanations: E0596, E0764.
57 For more information about an error, try `rustc --explain E0596`.