11warning: attempting to modify a `const` item
2- --> $DIR/lint-const-item-mutation.rs:17 :5
2+ --> $DIR/lint-const-item-mutation.rs:27 :5
33 |
44LL | ARRAY[0] = 5;
55 | ^^^^^^^^^^^^
66 |
77 = note: `#[warn(const_item_mutation)]` on by default
88 = note: each usage of a `const` item creates a new temporary - the original `const` item will not be modified
99note: `const` item defined here
10- --> $DIR/lint-const-item-mutation.rs:12 :1
10+ --> $DIR/lint-const-item-mutation.rs:21 :1
1111 |
1212LL | const ARRAY: [u8; 1] = [25];
1313 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1414
1515warning: attempting to modify a `const` item
16- --> $DIR/lint-const-item-mutation.rs:18 :5
16+ --> $DIR/lint-const-item-mutation.rs:28 :5
1717 |
1818LL | MY_STRUCT.field = false;
1919 | ^^^^^^^^^^^^^^^^^^^^^^^
2020 |
2121 = note: each usage of a `const` item creates a new temporary - the original `const` item will not be modified
2222note: `const` item defined here
23- --> $DIR/lint-const-item-mutation.rs:13 :1
23+ --> $DIR/lint-const-item-mutation.rs:22 :1
2424 |
2525LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
2626 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2727
2828warning: attempting to modify a `const` item
29- --> $DIR/lint-const-item-mutation.rs:19 :5
29+ --> $DIR/lint-const-item-mutation.rs:29 :5
3030 |
3131LL | MY_STRUCT.inner_array[0] = 'b';
3232 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3333 |
3434 = note: each usage of a `const` item creates a new temporary - the original `const` item will not be modified
3535note: `const` item defined here
36- --> $DIR/lint-const-item-mutation.rs:13 :1
36+ --> $DIR/lint-const-item-mutation.rs:22 :1
3737 |
3838LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
3939 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4040
4141warning: taking a mutable reference to a `const` item
42- --> $DIR/lint-const-item-mutation.rs:20 :5
42+ --> $DIR/lint-const-item-mutation.rs:30 :5
4343 |
4444LL | MY_STRUCT.use_mut();
4545 | ^^^^^^^^^^^^^^^^^^^
@@ -52,35 +52,35 @@ note: mutable reference created due to call to this method
5252LL | fn use_mut(&mut self) {}
5353 | ^^^^^^^^^^^^^^^^^^^^^
5454note: `const` item defined here
55- --> $DIR/lint-const-item-mutation.rs:13 :1
55+ --> $DIR/lint-const-item-mutation.rs:22 :1
5656 |
5757LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
5858 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5959
6060warning: taking a mutable reference to a `const` item
61- --> $DIR/lint-const-item-mutation.rs:21 :5
61+ --> $DIR/lint-const-item-mutation.rs:31 :5
6262 |
6363LL | &mut MY_STRUCT;
6464 | ^^^^^^^^^^^^^^
6565 |
6666 = note: each usage of a `const` item creates a new temporary
6767 = note: the mutable reference will refer to this temporary, not the original `const` item
6868note: `const` item defined here
69- --> $DIR/lint-const-item-mutation.rs:13 :1
69+ --> $DIR/lint-const-item-mutation.rs:22 :1
7070 |
7171LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
7272 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7373
7474warning: taking a mutable reference to a `const` item
75- --> $DIR/lint-const-item-mutation.rs:22 :5
75+ --> $DIR/lint-const-item-mutation.rs:32 :5
7676 |
7777LL | (&mut MY_STRUCT).use_mut();
7878 | ^^^^^^^^^^^^^^^^
7979 |
8080 = note: each usage of a `const` item creates a new temporary
8181 = note: the mutable reference will refer to this temporary, not the original `const` item
8282note: `const` item defined here
83- --> $DIR/lint-const-item-mutation.rs:13 :1
83+ --> $DIR/lint-const-item-mutation.rs:22 :1
8484 |
8585LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
8686 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0 commit comments