@@ -124,8 +124,8 @@ be specified exactly one time.
124
124
125
125
E0063 : r##"
126
126
This error indicates that during an attempt to build a struct or struct-like
127
- enum variant, one of the fields was not provided. Each field should be specified
128
- exactly once.
127
+ enum variant, one of the fields was not provided. Each field should be
128
+ specified exactly once.
129
129
"## ,
130
130
131
131
E0066 : r##"
@@ -141,7 +141,8 @@ and [RFC 809] for more details.
141
141
E0067 : r##"
142
142
The left-hand side of an assignment operator must be an lvalue expression. An
143
143
lvalue expression represents a memory location and includes item paths (ie,
144
- namespaced variables), dereferences, indexing expressions, and field references.
144
+ namespaced variables), dereferences, indexing expressions, and field
145
+ references.
145
146
146
147
```
147
148
use std::collections::LinkedList;
@@ -170,6 +171,37 @@ Since `return;` is just like `return ();`, there is a mismatch between the
170
171
function's return type and the value being returned.
171
172
"## ,
172
173
174
+ E0070 : r##"
175
+ The left-hand side of an assignment operator must be an lvalue expression. An
176
+ lvalue expression represents a memory location and can be a variable (with
177
+ optional namespacing), a dereference, an indexing expression or a field
178
+ reference.
179
+
180
+ More details can be found here:
181
+ https://doc.rust-lang.org/reference.html#lvalues,-rvalues-and-temporaries
182
+
183
+ Now, we can go further. Here are some bad examples:
184
+ ```
185
+ const SOME_CONST : i32 = 12;
186
+
187
+ fn some_other_func() {}
188
+
189
+ fn some_function() {
190
+ SOME_CONST = 14; // error : a constant value cannot be changed!
191
+ 1 = 3; // error : 1 isn't a valid lvalue!
192
+ some_other_func() = 4; // error : we can't assign value to a function!
193
+ }
194
+ ```
195
+
196
+ And now let's give good examples:
197
+
198
+ ```
199
+ let mut i : i32 = 1; // that's good
200
+
201
+ i = 3; // that's good !
202
+ ```
203
+ "## ,
204
+
173
205
E0072 : r##"
174
206
When defining a recursive struct or enum, any use of the type being defined
175
207
from inside the definition must occur behind a pointer (like `Box` or `&`).
@@ -779,7 +811,6 @@ register_diagnostics! {
779
811
E0060 ,
780
812
E0061 ,
781
813
E0068 ,
782
- E0070 ,
783
814
E0071 ,
784
815
E0074 ,
785
816
E0075 ,
0 commit comments