Improve invalid assignment error

This commit is contained in:
varkor 2019-12-22 18:42:15 +00:00
parent a5991c57cf
commit b7bfdbe681
15 changed files with 92 additions and 49 deletions

View file

@ -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

View file

@ -1,14 +1,18 @@
error[E0070]: invalid left-hand side expression
error[E0070]: invalid left-hand side of assignment
--> $DIR/E0070.rs:6:5
|
LL | SOME_CONST = 14;
| ^^^^^^^^^^^^^^^ 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/E0070.rs:7:5
|
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
error[E0070]: invalid left-hand side of assignment
--> $DIR/E0070.rs:8:5
|
LL | some_other_func() = 4;
| ^^^^^^^^^^^^^^^^^^^^^ left-hand of expression not valid
| -----------------^^^^
| |
| cannot assign to this expression
error: aborting due to 4 previous errors