1
1
warning: attempting to modify a `const` item
2
- --> $DIR/lint-const-item-mutation.rs:34 :5
2
+ --> $DIR/lint-const-item-mutation.rs:35 :5
3
3
|
4
4
LL | ARRAY[0] = 5;
5
5
| ^^^^^^^^^^^^
6
6
|
7
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
8
+ = note: each usage of a `const` item creates a new temporary; the original `const` item will not be modified
9
9
note: `const` item defined here
10
10
--> $DIR/lint-const-item-mutation.rs:26:1
11
11
|
12
12
LL | const ARRAY: [u8; 1] = [25];
13
13
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14
14
15
15
warning: attempting to modify a `const` item
16
- --> $DIR/lint-const-item-mutation.rs:35 :5
16
+ --> $DIR/lint-const-item-mutation.rs:36 :5
17
17
|
18
18
LL | MY_STRUCT.field = false;
19
19
| ^^^^^^^^^^^^^^^^^^^^^^^
20
20
|
21
- = note: each usage of a `const` item creates a new temporary - the original `const` item will not be modified
21
+ = note: each usage of a `const` item creates a new temporary; the original `const` item will not be modified
22
22
note: `const` item defined here
23
23
--> $DIR/lint-const-item-mutation.rs:27:1
24
24
|
25
25
LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
26
26
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27
27
28
28
warning: attempting to modify a `const` item
29
- --> $DIR/lint-const-item-mutation.rs:36 :5
29
+ --> $DIR/lint-const-item-mutation.rs:37 :5
30
30
|
31
31
LL | MY_STRUCT.inner_array[0] = 'b';
32
32
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33
33
|
34
- = note: each usage of a `const` item creates a new temporary - the original `const` item will not be modified
34
+ = note: each usage of a `const` item creates a new temporary; the original `const` item will not be modified
35
35
note: `const` item defined here
36
36
--> $DIR/lint-const-item-mutation.rs:27:1
37
37
|
38
38
LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
39
39
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
40
40
41
41
warning: taking a mutable reference to a `const` item
42
- --> $DIR/lint-const-item-mutation.rs:37 :5
42
+ --> $DIR/lint-const-item-mutation.rs:38 :5
43
43
|
44
44
LL | MY_STRUCT.use_mut();
45
45
| ^^^^^^^^^^^^^^^^^^^
@@ -58,7 +58,7 @@ LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw
58
58
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
59
59
60
60
warning: taking a mutable reference to a `const` item
61
- --> $DIR/lint-const-item-mutation.rs:38 :5
61
+ --> $DIR/lint-const-item-mutation.rs:39 :5
62
62
|
63
63
LL | &mut MY_STRUCT;
64
64
| ^^^^^^^^^^^^^^
@@ -72,7 +72,7 @@ LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw
72
72
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
73
73
74
74
warning: taking a mutable reference to a `const` item
75
- --> $DIR/lint-const-item-mutation.rs:39 :5
75
+ --> $DIR/lint-const-item-mutation.rs:40 :5
76
76
|
77
77
LL | (&mut MY_STRUCT).use_mut();
78
78
| ^^^^^^^^^^^^^^^^
@@ -86,20 +86,20 @@ LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw
86
86
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
87
87
88
88
warning: attempting to modify a `const` item
89
- --> $DIR/lint-const-item-mutation.rs:51 :5
89
+ --> $DIR/lint-const-item-mutation.rs:52 :5
90
90
|
91
91
LL | MUTABLE2.msg = "wow";
92
92
| ^^^^^^^^^^^^^^^^^^^^
93
93
|
94
- = note: each usage of a `const` item creates a new temporary - the original `const` item will not be modified
94
+ = note: each usage of a `const` item creates a new temporary; the original `const` item will not be modified
95
95
note: `const` item defined here
96
96
--> $DIR/lint-const-item-mutation.rs:30:1
97
97
|
98
98
LL | const MUTABLE2: Mutable2 = Mutable2 { msg: "", other: String::new() };
99
99
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
100
100
101
101
warning: taking a mutable reference to a `const` item
102
- --> $DIR/lint-const-item-mutation.rs:52 :5
102
+ --> $DIR/lint-const-item-mutation.rs:53 :5
103
103
|
104
104
LL | VEC.push(0);
105
105
| ^^^^^^^^^^^
0 commit comments