Rollup merge of #59453 - estebank:recover-tuple-parse, r=petrochenkov
Recover from parse error in tuple syntax
This commit is contained in:
commit
c28704c2a8
13 changed files with 228 additions and 34 deletions
|
|
@ -1,4 +1,10 @@
|
|||
fn main () {
|
||||
let sr: Vec<(u32, _, _) = vec![]; //~ ERROR expected one of `,` or `>`, found `=`
|
||||
let sr: Vec<(u32, _, _) = vec![];
|
||||
//~^ ERROR expected one of `,` or `>`, found `=`
|
||||
//~| ERROR expected value, found struct `Vec`
|
||||
//~| ERROR mismatched types
|
||||
//~| ERROR invalid left-hand side expression
|
||||
//~| ERROR expected expression, found reserved identifier `_`
|
||||
let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
|
||||
//~^ ERROR no method named `iter` found for type `()` in the current scope
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,47 @@
|
|||
error: expected expression, found reserved identifier `_`
|
||||
--> $DIR/issue-34334.rs:2:23
|
||||
|
|
||||
LL | let sr: Vec<(u32, _, _) = vec![];
|
||||
| ^ expected expression
|
||||
|
||||
error: expected one of `,` or `>`, found `=`
|
||||
--> $DIR/issue-34334.rs:2:29
|
||||
|
|
||||
LL | let sr: Vec<(u32, _, _) = vec![];
|
||||
| -- ^ expected one of `,` or `>` here
|
||||
| |
|
||||
| --- ^ expected one of `,` or `>` here
|
||||
| | |
|
||||
| | help: use `=` if you meant to assign
|
||||
| while parsing the type for `sr`
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0423]: expected value, found struct `Vec`
|
||||
--> $DIR/issue-34334.rs:2:13
|
||||
|
|
||||
LL | let sr: Vec<(u32, _, _) = vec![];
|
||||
| ^^^ did you mean `Vec { /* fields */ }`?
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-34334.rs:2:31
|
||||
|
|
||||
LL | let sr: Vec<(u32, _, _) = vec![];
|
||||
| ^^^^^^ expected bool, found struct `std::vec::Vec`
|
||||
|
|
||||
= note: expected type `bool`
|
||||
found type `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
|
||||
--> $DIR/issue-34334.rs:2:13
|
||||
|
|
||||
LL | let sr: Vec<(u32, _, _) = vec![];
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ left-hand of expression not valid
|
||||
|
||||
error[E0599]: no method named `iter` found for type `()` in the current scope
|
||||
--> $DIR/issue-34334.rs:8:36
|
||||
|
|
||||
LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
|
||||
| ^^^^
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors occurred: E0070, E0308, E0423, E0599.
|
||||
For more information about an error, try `rustc --explain E0070`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue