about summary refs log tree commit diff
path: root/src/test/ui/bad
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-12-22 18:42:15 +0000
committervarkor <github@varkor.com>2019-12-23 11:16:51 +0000
commitb7bfdbe68147f2ea8ca4870270643180bef76e02 (patch)
treefb88c336f1511d88f844f31703e7b14391b04b02 /src/test/ui/bad
parenta5991c57cf4430d1f67886637c65f2178ff1b372 (diff)
downloadrust-b7bfdbe68147f2ea8ca4870270643180bef76e02.tar.gz
rust-b7bfdbe68147f2ea8ca4870270643180bef76e02.zip
Improve invalid assignment error
Diffstat (limited to 'src/test/ui/bad')
-rw-r--r--src/test/ui/bad/bad-expr-lhs.rs10
-rw-r--r--src/test/ui/bad/bad-expr-lhs.stderr32
2 files changed, 26 insertions, 16 deletions
diff --git a/src/test/ui/bad/bad-expr-lhs.rs b/src/test/ui/bad/bad-expr-lhs.rs
index 2cd8bc9d473..d7cf1b77005 100644
--- a/src/test/ui/bad/bad-expr-lhs.rs
+++ b/src/test/ui/bad/bad-expr-lhs.rs
@@ -1,10 +1,10 @@
 fn main() {
-    1 = 2; //~ ERROR invalid left-hand side expression
-    1 += 2; //~ ERROR invalid left-hand side expression
-    (1, 2) = (3, 4); //~ ERROR invalid left-hand side expression
+    1 = 2; //~ ERROR invalid left-hand side of assignment
+    1 += 2; //~ ERROR invalid left-hand side of assignment
+    (1, 2) = (3, 4); //~ ERROR invalid left-hand side of assignment
 
     let (a, b) = (1, 2);
-    (a, b) = (3, 4); //~ ERROR invalid left-hand side expression
+    (a, b) = (3, 4); //~ ERROR invalid left-hand side of assignment
 
-    None = Some(3); //~ ERROR invalid left-hand side expression
+    None = Some(3); //~ ERROR invalid left-hand side of assignment
 }
diff --git a/src/test/ui/bad/bad-expr-lhs.stderr b/src/test/ui/bad/bad-expr-lhs.stderr
index a0de6a73797..07cffbe97a8 100644
--- a/src/test/ui/bad/bad-expr-lhs.stderr
+++ b/src/test/ui/bad/bad-expr-lhs.stderr
@@ -1,32 +1,42 @@
-error[E0070]: invalid left-hand side expression
+error[E0070]: invalid left-hand side of assignment
   --> $DIR/bad-expr-lhs.rs:2:5
    |
 LL |     1 = 2;
-   |     ^^^^^ left-hand of expression not valid
+   |     -^^^^
+   |     |
+   |     cannot assign to this expression
 
-error[E0067]: invalid left-hand side expression
-  --> $DIR/bad-expr-lhs.rs:3:5
+error[E0067]: invalid left-hand side of assignment
+  --> $DIR/bad-expr-lhs.rs:3:7
    |
 LL |     1 += 2;
-   |     ^ invalid expression for left-hand side
+   |     - ^^
+   |     |
+   |     cannot assign to this expression
 
-error[E0070]: invalid left-hand side expression
+error[E0070]: invalid left-hand side of assignment
   --> $DIR/bad-expr-lhs.rs:4:5
    |
 LL |     (1, 2) = (3, 4);
-   |     ^^^^^^^^^^^^^^^ left-hand of expression not valid
+   |     ------^^^^^^^^^
+   |     |
+   |     cannot assign to this expression
 
-error[E0070]: invalid left-hand side expression
+error[E0070]: invalid left-hand side of assignment
   --> $DIR/bad-expr-lhs.rs:7:5
    |
 LL |     (a, b) = (3, 4);
-   |     ^^^^^^^^^^^^^^^ left-hand of expression not valid
+   |     ------^^^^^^^^^
+   |     |
+   |     cannot assign to this expression
 
-error[E0070]: invalid left-hand side expression
+error[E0070]: invalid left-hand side of assignment
   --> $DIR/bad-expr-lhs.rs:9:5
    |
 LL |     None = Some(3);
-   |     ^^^^^^^^^^^^^^ left-hand of expression not valid
+   |     ----^^^^^^^^^^
+   |     |
+   |     cannot assign to this expression
 
 error: aborting due to 5 previous errors