]> git.lizzy.rs Git - rust.git/blob - tests/ui/lint/lint-const-item-mutation.stderr
Auto merge of #106884 - clubby789:fieldless-enum-debug, r=michaelwoerister
[rust.git] / tests / ui / lint / lint-const-item-mutation.stderr
1 warning: attempting to modify a `const` item
2   --> $DIR/lint-const-item-mutation.rs:37:5
3    |
4 LL |     ARRAY[0] = 5;
5    |     ^^^^^^^^^^^^
6    |
7    = note: each usage of a `const` item creates a new temporary; the original `const` item will not be modified
8 note: `const` item defined here
9   --> $DIR/lint-const-item-mutation.rs:26:1
10    |
11 LL | const ARRAY: [u8; 1] = [25];
12    | ^^^^^^^^^^^^^^^^^^^^
13    = note: `#[warn(const_item_mutation)]` on by default
14
15 warning: attempting to modify a `const` item
16   --> $DIR/lint-const-item-mutation.rs:38: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:39: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:40: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:41: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:42: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:54: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:55: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/mod.rs:LL:COL
111 note: `const` item defined here
112   --> $DIR/lint-const-item-mutation.rs:31:1
113    |
114 LL | const VEC: Vec<i32> = Vec::new();
115    | ^^^^^^^^^^^^^^^^^^^
116
117 warning: 8 warnings emitted
118