1 warning: attempting to modify a `const` item
2 --> $DIR/lint-const-item-mutation.rs:35:5
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
12 LL | const ARRAY: [u8; 1] = [25];
13 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15 warning: attempting to modify a `const` item
16 --> $DIR/lint-const-item-mutation.rs:36:5
18 LL | MY_STRUCT.field = false;
19 | ^^^^^^^^^^^^^^^^^^^^^^^
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
25 LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
26 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
28 warning: attempting to modify a `const` item
29 --> $DIR/lint-const-item-mutation.rs:37:5
31 LL | MY_STRUCT.inner_array[0] = 'b';
32 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
38 LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
39 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
41 warning: taking a mutable reference to a `const` item
42 --> $DIR/lint-const-item-mutation.rs:38:5
44 LL | MY_STRUCT.use_mut();
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
52 LL | fn use_mut(&mut self) {}
53 | ^^^^^^^^^^^^^^^^^^^^^
54 note: `const` item defined here
55 --> $DIR/lint-const-item-mutation.rs:27:1
57 LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
58 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
60 warning: taking a mutable reference to a `const` item
61 --> $DIR/lint-const-item-mutation.rs:39:5
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
71 LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
72 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
74 warning: taking a mutable reference to a `const` item
75 --> $DIR/lint-const-item-mutation.rs:40:5
77 LL | (&mut MY_STRUCT).use_mut();
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
85 LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
86 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88 warning: attempting to modify a `const` item
89 --> $DIR/lint-const-item-mutation.rs:52:5
91 LL | MUTABLE2.msg = "wow";
92 | ^^^^^^^^^^^^^^^^^^^^
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
98 LL | const MUTABLE2: Mutable2 = Mutable2 { msg: "", other: String::new() };
99 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
101 warning: taking a mutable reference to a `const` item
102 --> $DIR/lint-const-item-mutation.rs:53:5
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
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() {
120 note: `const` item defined here
121 --> $DIR/lint-const-item-mutation.rs:31:1
123 LL | const VEC: Vec<i32> = Vec::new();
124 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
126 warning: 8 warnings emitted