about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2015-05-20 18:59:12 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2015-05-20 23:46:37 +0200
commitdb9b4357495b9d64d2ce88f62f2db078f4aadfbc (patch)
treece9bc5828d73849fd5d8444760326fea0650381e
parentc795406e1917c99490fd68d19d10f577fb01a607 (diff)
downloadrust-db9b4357495b9d64d2ce88f62f2db078f4aadfbc.tar.gz
rust-db9b4357495b9d64d2ce88f62f2db078f4aadfbc.zip
Typo fix on E0067
-rw-r--r--src/librustc_typeck/diagnostics.rs32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs
index 7b48beae572..3c362285e0e 100644
--- a/src/librustc_typeck/diagnostics.rs
+++ b/src/librustc_typeck/diagnostics.rs
@@ -139,20 +139,36 @@ and [RFC 809] for more details.
 "##,
 
 E0067: r##"
-The left-hand side of an assignment operator must be an lvalue expression. An
-lvalue expression represents a memory location and includes item paths (ie,
-namespaced variables), dereferences, indexing expressions, and field
-references.
+The left-hand side of a compound assignment expression must be an lvalue
+expression. An lvalue expression represents a memory location and includes
+item paths (ie, namespaced variables), dereferences, indexing expressions,
+and field references.
 
+Let's start with some bad examples:
 ```
 use std::collections::LinkedList;
 
-// Good
-let mut list = LinkedList::new();
-
-
 // Bad: assignment to non-lvalue expression
 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 !
+}
+
 ```
 "##,