]> git.proxmox.com Git - rustc.git/blob - src/test/ui/lint/lint-const-item-mutation.stderr
New upstream version 1.49.0~beta.4+dfsg1
[rustc.git] / src / test / ui / lint / lint-const-item-mutation.stderr
1 warning: attempting to modify a `const` item
2 --> $DIR/lint-const-item-mutation.rs:35:5
3 |
4 LL | ARRAY[0] = 5;
5 | ^^^^^^^^^^^^
6 |
7 = note: `#[warn(const_item_mutation)]` on by default
8 = note: each usage of a `const` item creates a new temporary; the original `const` item will not be modified
9 note: `const` item defined here
10 --> $DIR/lint-const-item-mutation.rs:26:1
11 |
12 LL | const ARRAY: [u8; 1] = [25];
13 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14
15 warning: attempting to modify a `const` item
16 --> $DIR/lint-const-item-mutation.rs:36:5
17 |
18 LL | MY_STRUCT.field = false;
19 | ^^^^^^^^^^^^^^^^^^^^^^^
20 |
21 = note: each usage of a `const` item creates a new temporary; the original `const` item will not be modified
22 note: `const` item defined here
23 --> $DIR/lint-const-item-mutation.rs:27:1
24 |
25 LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
26 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27
28 warning: attempting to modify a `const` item
29 --> $DIR/lint-const-item-mutation.rs:37:5
30 |
31 LL | MY_STRUCT.inner_array[0] = 'b';
32 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33 |
34 = note: each usage of a `const` item creates a new temporary; the original `const` item will not be modified
35 note: `const` item defined here
36 --> $DIR/lint-const-item-mutation.rs:27:1
37 |
38 LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
39 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
40
41 warning: taking a mutable reference to a `const` item
42 --> $DIR/lint-const-item-mutation.rs:38:5
43 |
44 LL | MY_STRUCT.use_mut();
45 | ^^^^^^^^^^^^^^^^^^^
46 |
47 = note: each usage of a `const` item creates a new temporary
48 = note: the mutable reference will refer to this temporary, not the original `const` item
49 note: mutable reference created due to call to this method
50 --> $DIR/lint-const-item-mutation.rs:9:5
51 |
52 LL | fn use_mut(&mut self) {}
53 | ^^^^^^^^^^^^^^^^^^^^^
54 note: `const` item defined here
55 --> $DIR/lint-const-item-mutation.rs:27:1
56 |
57 LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
58 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
59
60 warning: taking a mutable reference to a `const` item
61 --> $DIR/lint-const-item-mutation.rs:39:5
62 |
63 LL | &mut MY_STRUCT;
64 | ^^^^^^^^^^^^^^
65 |
66 = note: each usage of a `const` item creates a new temporary
67 = note: the mutable reference will refer to this temporary, not the original `const` item
68 note: `const` item defined here
69 --> $DIR/lint-const-item-mutation.rs:27:1
70 |
71 LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
72 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
73
74 warning: taking a mutable reference to a `const` item
75 --> $DIR/lint-const-item-mutation.rs:40:5
76 |
77 LL | (&mut MY_STRUCT).use_mut();
78 | ^^^^^^^^^^^^^^^^
79 |
80 = note: each usage of a `const` item creates a new temporary
81 = note: the mutable reference will refer to this temporary, not the original `const` item
82 note: `const` item defined here
83 --> $DIR/lint-const-item-mutation.rs:27:1
84 |
85 LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
86 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
87
88 warning: attempting to modify a `const` item
89 --> $DIR/lint-const-item-mutation.rs:52:5
90 |
91 LL | MUTABLE2.msg = "wow";
92 | ^^^^^^^^^^^^^^^^^^^^
93 |
94 = note: each usage of a `const` item creates a new temporary; the original `const` item will not be modified
95 note: `const` item defined here
96 --> $DIR/lint-const-item-mutation.rs:30:1
97 |
98 LL | const MUTABLE2: Mutable2 = Mutable2 { msg: "", other: String::new() };
99 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
100
101 warning: taking a mutable reference to a `const` item
102 --> $DIR/lint-const-item-mutation.rs:53:5
103 |
104 LL | VEC.push(0);
105 | ^^^^^^^^^^^
106 |
107 = note: each usage of a `const` item creates a new temporary
108 = note: the mutable reference will refer to this temporary, not the original `const` item
109 note: mutable reference created due to call to this method
110 --> $SRC_DIR/alloc/src/vec.rs:LL:COL
111 |
112 LL | / pub fn push(&mut self, value: T) {
113 LL | | // This will panic or abort if we would allocate > isize::MAX bytes
114 LL | | // or if the length increment would overflow for zero-sized types.
115 LL | | if self.len == self.buf.capacity() {
116 ... |
117 LL | | }
118 LL | | }
119 | |_____^
120 note: `const` item defined here
121 --> $DIR/lint-const-item-mutation.rs:31:1
122 |
123 LL | const VEC: Vec<i32> = Vec::new();
124 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
125
126 warning: 8 warnings emitted
127