about summary refs log tree commit diff
path: root/src/test/ui/error-codes
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-12-23 15:16:29 +0100
committerGitHub <noreply@github.com>2019-12-23 15:16:29 +0100
commit41647613b1a69e7df7490d23fee2823da249cda4 (patch)
tree3cbd0c9868d8e99dc6a3af9134e70523fb49d2a5 /src/test/ui/error-codes
parent3a07f3ba75d2f0a180be44915df2c929966d39cd (diff)
parent9e5081394cac4429de287e6c10b350f698a97f65 (diff)
downloadrust-41647613b1a69e7df7490d23fee2823da249cda4.tar.gz
rust-41647613b1a69e7df7490d23fee2823da249cda4.zip
Rollup merge of #67538 - varkor:lhs-assign-diagnostics, r=Centril
Improve diagnostics for invalid assignment

- Improve wording and span information for invalid assignment diagnostics.
- Link to https://github.com/rust-lang/rfcs/issues/372 when it appears the user is trying a destructuring assignment.
- Make the equality constraint in `where` clauses error consistent with the invalid assignment error.
Diffstat (limited to 'src/test/ui/error-codes')
-rw-r--r--src/test/ui/error-codes/E0067.stderr8
-rw-r--r--src/test/ui/error-codes/E0070.stderr24
2 files changed, 20 insertions, 12 deletions
diff --git a/src/test/ui/error-codes/E0067.stderr b/src/test/ui/error-codes/E0067.stderr
index 0334565840f..526503798b3 100644
--- a/src/test/ui/error-codes/E0067.stderr
+++ b/src/test/ui/error-codes/E0067.stderr
@@ -8,11 +8,13 @@ LL |     LinkedList::new() += 1;
    |
    = note: an implementation of `std::ops::AddAssign` might be missing for `std::collections::LinkedList<_>`
 
-error[E0067]: invalid left-hand side expression
-  --> $DIR/E0067.rs:4:5
+error[E0067]: invalid left-hand side of assignment
+  --> $DIR/E0067.rs:4:23
    |
 LL |     LinkedList::new() += 1;
-   |     ^^^^^^^^^^^^^^^^^ invalid expression for left-hand side
+   |     ----------------- ^^
+   |     |
+   |     cannot assign to this expression
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/error-codes/E0070.stderr b/src/test/ui/error-codes/E0070.stderr
index 845833bc82f..d809bb18dee 100644
--- a/src/test/ui/error-codes/E0070.stderr
+++ b/src/test/ui/error-codes/E0070.stderr
@@ -1,14 +1,18 @@
-error[E0070]: invalid left-hand side expression
-  --> $DIR/E0070.rs:6:5
+error[E0070]: invalid left-hand side of assignment
+  --> $DIR/E0070.rs:6:16
    |
 LL |     SOME_CONST = 14;
-   |     ^^^^^^^^^^^^^^^ left-hand of expression not valid
+   |     ---------- ^
+   |     |
+   |     cannot assign to this expression
 
-error[E0070]: invalid left-hand side expression
-  --> $DIR/E0070.rs:7:5
+error[E0070]: invalid left-hand side of assignment
+  --> $DIR/E0070.rs:7:7
    |
 LL |     1 = 3;
-   |     ^^^^^ left-hand of expression not valid
+   |     - ^
+   |     |
+   |     cannot assign to this expression
 
 error[E0308]: mismatched types
   --> $DIR/E0070.rs:8:25
@@ -16,11 +20,13 @@ error[E0308]: mismatched types
 LL |     some_other_func() = 4;
    |                         ^ expected `()`, found integer
 
-error[E0070]: invalid left-hand side expression
-  --> $DIR/E0070.rs:8:5
+error[E0070]: invalid left-hand side of assignment
+  --> $DIR/E0070.rs:8:23
    |
 LL |     some_other_func() = 4;
-   |     ^^^^^^^^^^^^^^^^^^^^^ left-hand of expression not valid
+   |     ----------------- ^
+   |     |
+   |     cannot assign to this expression
 
 error: aborting due to 4 previous errors