Improve invalid assignment error
This commit is contained in:
parent
a5991c57cf
commit
b7bfdbe681
15 changed files with 92 additions and 49 deletions
|
|
@ -4,7 +4,7 @@ mod A {
|
|||
|
||||
fn main() {
|
||||
A::C = 1;
|
||||
//~^ ERROR: invalid left-hand side expression
|
||||
//~^ ERROR: invalid left-hand side of assignment
|
||||
//~| ERROR: mismatched types
|
||||
//~| ERROR: struct `C` is private
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,13 @@ error[E0308]: mismatched types
|
|||
LL | A::C = 1;
|
||||
| ^ expected struct `A::C`, found integer
|
||||
|
||||
error[E0070]: invalid left-hand side expression
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/issue-13407.rs:6:5
|
||||
|
|
||||
LL | A::C = 1;
|
||||
| ^^^^^^^^ left-hand of expression not valid
|
||||
| ----^^^^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
macro_rules! not_a_place {
|
||||
($thing:expr) => {
|
||||
$thing = 42;
|
||||
//~^ ERROR invalid left-hand side expression
|
||||
//~^ ERROR invalid left-hand side of assignment
|
||||
$thing += 42;
|
||||
//~^ ERROR invalid left-hand side of assignment
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,28 @@
|
|||
error[E0070]: invalid left-hand side expression
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/issue-26093.rs:3:9
|
||||
|
|
||||
LL | $thing = 42;
|
||||
| ^^^^^^^^^^^ left-hand of expression not valid
|
||||
| ^^^^^^^^^^^
|
||||
...
|
||||
LL | not_a_place!(99);
|
||||
| ----------------- in this macro invocation
|
||||
| -----------------
|
||||
| | |
|
||||
| | cannot assign to this expression
|
||||
| in this macro invocation
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0067]: invalid left-hand side of assignment
|
||||
--> $DIR/issue-26093.rs:5:16
|
||||
|
|
||||
LL | $thing += 42;
|
||||
| ^^
|
||||
...
|
||||
LL | not_a_place!(99);
|
||||
| -----------------
|
||||
| | |
|
||||
| | cannot assign to this expression
|
||||
| in this macro invocation
|
||||
|
||||
For more information about this error, try `rustc --explain E0070`.
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0067, E0070.
|
||||
For more information about an error, try `rustc --explain E0067`.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ fn main () {
|
|||
//~^ ERROR expected one of `,` or `>`, found `=`
|
||||
//~| ERROR expected value, found struct `Vec`
|
||||
//~| ERROR mismatched types
|
||||
//~| ERROR invalid left-hand side expression
|
||||
//~| ERROR invalid left-hand side of assignment
|
||||
//~| ERROR expected expression, found reserved identifier `_`
|
||||
//~| ERROR expected expression, found reserved identifier `_`
|
||||
let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
|
||||
|
|
|
|||
|
|
@ -35,11 +35,13 @@ LL | let sr: Vec<(u32, _, _) = vec![];
|
|||
found struct `std::vec::Vec<_>`
|
||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
error[E0070]: invalid left-hand side expression
|
||||
error[E0070]: invalid left-hand side of assignment
|
||||
--> $DIR/issue-34334.rs:2:13
|
||||
|
|
||||
LL | let sr: Vec<(u32, _, _) = vec![];
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ left-hand of expression not valid
|
||||
| ---------------^^^^^^^^^
|
||||
| |
|
||||
| cannot assign to this expression
|
||||
|
||||
error[E0599]: no method named `iter` found for type `()` in the current scope
|
||||
--> $DIR/issue-34334.rs:9:36
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue