Skip to content

Commit 2e666b5

Browse files
---
yaml --- r: 207634 b: refs/heads/tmp c: db9b435 h: refs/heads/master v: v3
1 parent bdaedbb commit 2e666b5

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3232
refs/heads/beta: cd7d89af9169885642d43597302af69f842bbd78
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
35-
refs/heads/tmp: c795406e1917c99490fd68d19d10f577fb01a607
35+
refs/heads/tmp: db9b4357495b9d64d2ce88f62f2db078f4aadfbc
3636
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3737
refs/tags/homu-tmp: 704c2ee730d2e948d11a2edd77e3f35de8329a6e
3838
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

branches/tmp/src/librustc_typeck/diagnostics.rs

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,36 @@ and [RFC 809] for more details.
139139
"##,
140140

141141
E0067: r##"
142-
The left-hand side of an assignment operator must be an lvalue expression. An
143-
lvalue expression represents a memory location and includes item paths (ie,
144-
namespaced variables), dereferences, indexing expressions, and field
145-
references.
142+
The left-hand side of a compound assignment expression must be an lvalue
143+
expression. An lvalue expression represents a memory location and includes
144+
item paths (ie, namespaced variables), dereferences, indexing expressions,
145+
and field references.
146146
147+
Let's start with some bad examples:
147148
```
148149
use std::collections::LinkedList;
149150
150-
// Good
151-
let mut list = LinkedList::new();
152-
153-
154151
// Bad: assignment to non-lvalue expression
155152
LinkedList::new() += 1;
153+
154+
// ...
155+
156+
fn some_func(i: &mut i32) {
157+
i += 12; // Error : '+=' operation cannot be applied on a reference !
158+
}
159+
160+
And now some good examples:
161+
```
162+
let mut i : i32 = 0;
163+
164+
i += 12; // Good !
165+
166+
// ...
167+
168+
fn some_func(i: &mut i32) {
169+
*i += 12; // Good !
170+
}
171+
156172
```
157173
"##,
158174

0 commit comments

Comments
 (0)