Typo fix on E0067
This commit is contained in:
parent
c795406e19
commit
db9b435749
@ -139,20 +139,36 @@ and [RFC 809] for more details.
|
|||||||
"##,
|
"##,
|
||||||
|
|
||||||
E0067: r##"
|
E0067: r##"
|
||||||
The left-hand side of an assignment operator must be an lvalue expression. An
|
The left-hand side of a compound assignment expression must be an lvalue
|
||||||
lvalue expression represents a memory location and includes item paths (ie,
|
expression. An lvalue expression represents a memory location and includes
|
||||||
namespaced variables), dereferences, indexing expressions, and field
|
item paths (ie, namespaced variables), dereferences, indexing expressions,
|
||||||
references.
|
and field references.
|
||||||
|
|
||||||
|
Let's start with some bad examples:
|
||||||
```
|
```
|
||||||
use std::collections::LinkedList;
|
use std::collections::LinkedList;
|
||||||
|
|
||||||
// Good
|
|
||||||
let mut list = LinkedList::new();
|
|
||||||
|
|
||||||
|
|
||||||
// Bad: assignment to non-lvalue expression
|
// Bad: assignment to non-lvalue expression
|
||||||
LinkedList::new() += 1;
|
LinkedList::new() += 1;
|
||||||
|
|
||||||
|
// ...
|
||||||
|
|
||||||
|
fn some_func(i: &mut i32) {
|
||||||
|
i += 12; // Error : '+=' operation cannot be applied on a reference !
|
||||||
|
}
|
||||||
|
|
||||||
|
And now some good examples:
|
||||||
|
```
|
||||||
|
let mut i : i32 = 0;
|
||||||
|
|
||||||
|
i += 12; // Good !
|
||||||
|
|
||||||
|
// ...
|
||||||
|
|
||||||
|
fn some_func(i: &mut i32) {
|
||||||
|
*i += 12; // Good !
|
||||||
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
"##,
|
"##,
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user