|
1 | 1 | warning: attempting to modify a `const` item |
2 | | - --> $DIR/lint-const-item-mutation.rs:15:5 |
| 2 | + --> $DIR/lint-const-item-mutation.rs:17:5 |
3 | 3 | | |
4 | 4 | LL | ARRAY[0] = 5; |
5 | 5 | | ^^^^^^^^^^^^ |
6 | 6 | | |
7 | 7 | = note: `#[warn(const_item_mutation)]` on by default |
8 | 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 | | - --> $DIR/lint-const-item-mutation.rs:11:1 |
| 10 | + --> $DIR/lint-const-item-mutation.rs:12: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:16:5 |
| 16 | + --> $DIR/lint-const-item-mutation.rs:18:5 |
17 | 17 | | |
18 | 18 | LL | MY_STRUCT.field = false; |
19 | 19 | | ^^^^^^^^^^^^^^^^^^^^^^^ |
20 | 20 | | |
21 | 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 | | - --> $DIR/lint-const-item-mutation.rs:12:1 |
| 23 | + --> $DIR/lint-const-item-mutation.rs:13:1 |
24 | 24 | | |
25 | | -LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'] }; |
26 | | - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 25 | +LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 }; |
| 26 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
27 | 27 |
|
28 | 28 | warning: attempting to modify a `const` item |
29 | | - --> $DIR/lint-const-item-mutation.rs:17:5 |
| 29 | + --> $DIR/lint-const-item-mutation.rs:19:5 |
30 | 30 | | |
31 | 31 | LL | MY_STRUCT.inner_array[0] = 'b'; |
32 | 32 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
33 | 33 | | |
34 | 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 | | - --> $DIR/lint-const-item-mutation.rs:12:1 |
| 36 | + --> $DIR/lint-const-item-mutation.rs:13:1 |
37 | 37 | | |
38 | | -LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'] }; |
39 | | - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 38 | +LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 }; |
| 39 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
40 | 40 |
|
41 | 41 | warning: taking a mutable reference to a `const` item |
42 | | - --> $DIR/lint-const-item-mutation.rs:18:5 |
| 42 | + --> $DIR/lint-const-item-mutation.rs:20:5 |
43 | 43 | | |
44 | 44 | LL | MY_STRUCT.use_mut(); |
45 | 45 | | ^^^^^^^^^^^^^^^^^^^ |
46 | 46 | | |
47 | 47 | = note: each usage of a `const` item creates a new temporary |
48 | 48 | = note: the mutable reference will refer to this temporary, not the original `const` item |
49 | 49 | note: mutable reference created due to call to this method |
50 | | - --> $DIR/lint-const-item-mutation.rs:8:5 |
| 50 | + --> $DIR/lint-const-item-mutation.rs:9:5 |
51 | 51 | | |
52 | 52 | LL | fn use_mut(&mut self) {} |
53 | 53 | | ^^^^^^^^^^^^^^^^^^^^^ |
54 | 54 | note: `const` item defined here |
55 | | - --> $DIR/lint-const-item-mutation.rs:12:1 |
| 55 | + --> $DIR/lint-const-item-mutation.rs:13:1 |
56 | 56 | | |
57 | | -LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'] }; |
58 | | - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 57 | +LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 }; |
| 58 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
59 | 59 |
|
60 | 60 | warning: taking a mutable reference to a `const` item |
61 | | - --> $DIR/lint-const-item-mutation.rs:19:5 |
| 61 | + --> $DIR/lint-const-item-mutation.rs:21:5 |
62 | 62 | | |
63 | 63 | LL | &mut MY_STRUCT; |
64 | 64 | | ^^^^^^^^^^^^^^ |
65 | 65 | | |
66 | 66 | = note: each usage of a `const` item creates a new temporary |
67 | 67 | = note: the mutable reference will refer to this temporary, not the original `const` item |
68 | 68 | note: `const` item defined here |
69 | | - --> $DIR/lint-const-item-mutation.rs:12:1 |
| 69 | + --> $DIR/lint-const-item-mutation.rs:13:1 |
70 | 70 | | |
71 | | -LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'] }; |
72 | | - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 71 | +LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 }; |
| 72 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
73 | 73 |
|
74 | 74 | warning: taking a mutable reference to a `const` item |
75 | | - --> $DIR/lint-const-item-mutation.rs:20:5 |
| 75 | + --> $DIR/lint-const-item-mutation.rs:22:5 |
76 | 76 | | |
77 | 77 | LL | (&mut MY_STRUCT).use_mut(); |
78 | 78 | | ^^^^^^^^^^^^^^^^ |
79 | 79 | | |
80 | 80 | = note: each usage of a `const` item creates a new temporary |
81 | 81 | = note: the mutable reference will refer to this temporary, not the original `const` item |
82 | 82 | note: `const` item defined here |
83 | | - --> $DIR/lint-const-item-mutation.rs:12:1 |
| 83 | + --> $DIR/lint-const-item-mutation.rs:13:1 |
84 | 84 | | |
85 | | -LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'] }; |
86 | | - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 85 | +LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 }; |
| 86 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
87 | 87 |
|
88 | 88 | warning: 6 warnings emitted |
89 | 89 |
|
0 commit comments