Skip to content

Commit 87c1f16

Browse files
---
yaml --- r: 208803 b: refs/heads/snap-stage3 c: db9b435 h: refs/heads/master i: 208801: 78772cd 208799: 9f78df1 v: v3
1 parent ed2f105 commit 87c1f16

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
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 38a97becdf3e6a6157f6f7ec2d98ade8d8edc193
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: c795406e1917c99490fd68d19d10f577fb01a607
4+
refs/heads/snap-stage3: db9b4357495b9d64d2ce88f62f2db078f4aadfbc
55
refs/heads/try: 7b4ef47b7805a402d756fb8157101f64880a522f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/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)