fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
4.2 KiB118 linesraw
1warning: attempting to modify a `const` item
2  --> $DIR/lint-const-item-mutation.rs:37:5
3   |
4LL |     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
8note: `const` item defined here
9  --> $DIR/lint-const-item-mutation.rs:26:1
10   |
11LL | const ARRAY: [u8; 1] = [25];
12   | ^^^^^^^^^^^^^^^^^^^^
13   = note: `#[warn(const_item_mutation)]` on by default
14
15warning: attempting to modify a `const` item
16  --> $DIR/lint-const-item-mutation.rs:38:5
17   |
18LL |     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
22note: `const` item defined here
23  --> $DIR/lint-const-item-mutation.rs:27:1
24   |
25LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
26   | ^^^^^^^^^^^^^^^^^^^^^^^^^
27
28warning: attempting to modify a `const` item
29  --> $DIR/lint-const-item-mutation.rs:39:5
30   |
31LL |     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
35note: `const` item defined here
36  --> $DIR/lint-const-item-mutation.rs:27:1
37   |
38LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
39   | ^^^^^^^^^^^^^^^^^^^^^^^^^
40
41warning: taking a mutable reference to a `const` item
42  --> $DIR/lint-const-item-mutation.rs:40:5
43   |
44LL |     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
49note: mutable reference created due to call to this method
50  --> $DIR/lint-const-item-mutation.rs:9:5
51   |
52LL |     fn use_mut(&mut self) {}
53   |     ^^^^^^^^^^^^^^^^^^^^^
54note: `const` item defined here
55  --> $DIR/lint-const-item-mutation.rs:27:1
56   |
57LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
58   | ^^^^^^^^^^^^^^^^^^^^^^^^^
59
60warning: taking a mutable reference to a `const` item
61  --> $DIR/lint-const-item-mutation.rs:41:5
62   |
63LL |     &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
68note: `const` item defined here
69  --> $DIR/lint-const-item-mutation.rs:27:1
70   |
71LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
72   | ^^^^^^^^^^^^^^^^^^^^^^^^^
73
74warning: taking a mutable reference to a `const` item
75  --> $DIR/lint-const-item-mutation.rs:42:5
76   |
77LL |     (&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
82note: `const` item defined here
83  --> $DIR/lint-const-item-mutation.rs:27:1
84   |
85LL | const MY_STRUCT: MyStruct = MyStruct { field: true, inner_array: ['a'], raw_ptr: 2 as *mut u8 };
86   | ^^^^^^^^^^^^^^^^^^^^^^^^^
87
88warning: attempting to modify a `const` item
89  --> $DIR/lint-const-item-mutation.rs:54:5
90   |
91LL |     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
95note: `const` item defined here
96  --> $DIR/lint-const-item-mutation.rs:30:1
97   |
98LL | const MUTABLE2: Mutable2 = Mutable2 { msg: "", other: String::new() };
99   | ^^^^^^^^^^^^^^^^^^^^^^^^
100
101warning: taking a mutable reference to a `const` item
102  --> $DIR/lint-const-item-mutation.rs:55:5
103   |
104LL |     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
109note: mutable reference created due to call to this method
110  --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
111note: `const` item defined here
112  --> $DIR/lint-const-item-mutation.rs:31:1
113   |
114LL | const VEC: Vec<i32> = Vec::new();
115   | ^^^^^^^^^^^^^^^^^^^
116
117warning: 8 warnings emitted
118