about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2019-11-25 13:53:55 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2019-11-25 15:39:07 +0100
commit1bd28b1087b067df4037cbbe2f48db7776e3deaa (patch)
tree60bbf3ee9021d957419d63f7eeff8ec39c526231
parentef35980ffbdf70870c37b78aa2da1bcf1ee775a2 (diff)
downloadrust-1bd28b1087b067df4037cbbe2f48db7776e3deaa.tar.gz
rust-1bd28b1087b067df4037cbbe2f48db7776e3deaa.zip
Clean up E0070 long explanation
-rw-r--r--src/librustc_error_codes/error_codes/E0070.md38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/librustc_error_codes/error_codes/E0070.md b/src/librustc_error_codes/error_codes/E0070.md
index 1a56080a097..97522af3da8 100644
--- a/src/librustc_error_codes/error_codes/E0070.md
+++ b/src/librustc_error_codes/error_codes/E0070.md
@@ -1,41 +1,43 @@
-The left-hand side of an assignment operator must be a place expression. A
-place expression represents a memory location and can be a variable (with
-optional namespacing), a dereference, an indexing expression or a field
-reference.
+An assignment operator was used on a non-place expression.
 
-More details can be found in the [Expressions] section of the Reference.
-
-[Expressions]: https://doc.rust-lang.org/reference/expressions.html#places-rvalues-and-temporaries
-
-Now, we can go further. Here are some erroneous code examples:
+Erroneous code examples:
 
 ```compile_fail,E0070
 struct SomeStruct {
     x: i32,
-    y: i32
+    y: i32,
 }
 
-const SOME_CONST : i32 = 12;
+const SOME_CONST: i32 = 12;
 
 fn some_other_func() {}
 
 fn some_function() {
-    SOME_CONST = 14; // error : a constant value cannot be changed!
-    1 = 3; // error : 1 isn't a valid place!
-    some_other_func() = 4; // error : we cannot assign value to a function!
-    SomeStruct.x = 12; // error : SomeStruct a structure name but it is used
-                       // like a variable!
+    SOME_CONST = 14; // error: a constant value cannot be changed!
+    1 = 3; // error: 1 isn't a valid place!
+    some_other_func() = 4; // error: we cannot assign value to a function!
+    SomeStruct::x = 12; // error: SomeStruct a structure name but it is used
+                        //        like a variable!
 }
 ```
 
+The left-hand side of an assignment operator must be a place expression. A
+place expression represents a memory location and can be a variable (with
+optional namespacing), a dereference, an indexing expression or a field
+reference.
+
+More details can be found in the [Expressions] section of the Reference.
+
+[Expressions]: https://doc.rust-lang.org/reference/expressions.html#places-rvalues-and-temporaries
+
 And now let's give working examples:
 
 ```
 struct SomeStruct {
     x: i32,
-    y: i32
+    y: i32,
 }
-let mut s = SomeStruct {x: 0, y: 0};
+let mut s = SomeStruct { x: 0, y: 0 };
 
 s.x = 3; // that's good !