in which parentheses are suggested for should-have-been-tuple-patterns
Programmers used to working in some other languages (such as Python or
Go) might expect to be able to destructure values with comma-separated
identifiers but no parentheses on the left side of an assignment.
Previously, the first name in such code would get parsed as a
single-indentifier pattern—recognizing, for example, the
`let a` in `let a, b = (1, 2);`—whereupon we would have a fatal syntax
error on seeing an unexpected comma rather than the expected semicolon
(all the way nearer to the end of `parse_full_stmt`).
Instead, let's look for that comma when parsing the pattern, and if we
see it, momentarily make-believe that we're parsing the remaining
elements in a tuple pattern, so that we can suggest wrapping it all in
parentheses. We need to do this in a separate wrapper method called on
the top-level pattern (or `|`-patterns) in a `let` statement, `for`
loop, `if`- or `while let` expression, or match arm rather than within
`parse_pat` itself, because `parse_pat` gets called recursively to parse
the sub-patterns within a tuple pattern.
Resolves #48492.
2018-02-25 04:41:16 +00:00
|
|
|
error: unexpected `,` in pattern
|
2018-12-25 15:56:47 +00:00
|
|
|
--> $DIR/issue-48492-tuple-destructure-missing-parens.rs:38:17
|
in which parentheses are suggested for should-have-been-tuple-patterns
Programmers used to working in some other languages (such as Python or
Go) might expect to be able to destructure values with comma-separated
identifiers but no parentheses on the left side of an assignment.
Previously, the first name in such code would get parsed as a
single-indentifier pattern—recognizing, for example, the
`let a` in `let a, b = (1, 2);`—whereupon we would have a fatal syntax
error on seeing an unexpected comma rather than the expected semicolon
(all the way nearer to the end of `parse_full_stmt`).
Instead, let's look for that comma when parsing the pattern, and if we
see it, momentarily make-believe that we're parsing the remaining
elements in a tuple pattern, so that we can suggest wrapping it all in
parentheses. We need to do this in a separate wrapper method called on
the top-level pattern (or `|`-patterns) in a `let` statement, `for`
loop, `if`- or `while let` expression, or match arm rather than within
`parse_pat` itself, because `parse_pat` gets called recursively to parse
the sub-patterns within a tuple pattern.
Resolves #48492.
2018-02-25 04:41:16 +00:00
|
|
|
|
|
|
|
|
LL | while let b1, b2, b3 = reading_frame.next().expect("there should be a start codon") {
|
2022-01-12 20:43:24 +00:00
|
|
|
| ----- ^
|
|
|
|
| |
|
|
|
|
| while parsing the condition of this `while` expression
|
2019-10-24 05:20:58 +00:00
|
|
|
|
|
2022-01-12 20:43:24 +00:00
|
|
|
help: try adding parentheses to match on a tuple
|
2019-01-30 04:50:44 +00:00
|
|
|
|
|
|
|
|
LL | while let (b1, b2, b3) = reading_frame.next().expect("there should be a start codon") {
|
2022-01-12 20:43:24 +00:00
|
|
|
| + +
|
in which parentheses are suggested for should-have-been-tuple-patterns
Programmers used to working in some other languages (such as Python or
Go) might expect to be able to destructure values with comma-separated
identifiers but no parentheses on the left side of an assignment.
Previously, the first name in such code would get parsed as a
single-indentifier pattern—recognizing, for example, the
`let a` in `let a, b = (1, 2);`—whereupon we would have a fatal syntax
error on seeing an unexpected comma rather than the expected semicolon
(all the way nearer to the end of `parse_full_stmt`).
Instead, let's look for that comma when parsing the pattern, and if we
see it, momentarily make-believe that we're parsing the remaining
elements in a tuple pattern, so that we can suggest wrapping it all in
parentheses. We need to do this in a separate wrapper method called on
the top-level pattern (or `|`-patterns) in a `let` statement, `for`
loop, `if`- or `while let` expression, or match arm rather than within
`parse_pat` itself, because `parse_pat` gets called recursively to parse
the sub-patterns within a tuple pattern.
Resolves #48492.
2018-02-25 04:41:16 +00:00
|
|
|
|
|
|
|
error: unexpected `,` in pattern
|
2018-12-25 15:56:47 +00:00
|
|
|
--> $DIR/issue-48492-tuple-destructure-missing-parens.rs:49:14
|
in which parentheses are suggested for should-have-been-tuple-patterns
Programmers used to working in some other languages (such as Python or
Go) might expect to be able to destructure values with comma-separated
identifiers but no parentheses on the left side of an assignment.
Previously, the first name in such code would get parsed as a
single-indentifier pattern—recognizing, for example, the
`let a` in `let a, b = (1, 2);`—whereupon we would have a fatal syntax
error on seeing an unexpected comma rather than the expected semicolon
(all the way nearer to the end of `parse_full_stmt`).
Instead, let's look for that comma when parsing the pattern, and if we
see it, momentarily make-believe that we're parsing the remaining
elements in a tuple pattern, so that we can suggest wrapping it all in
parentheses. We need to do this in a separate wrapper method called on
the top-level pattern (or `|`-patterns) in a `let` statement, `for`
loop, `if`- or `while let` expression, or match arm rather than within
`parse_pat` itself, because `parse_pat` gets called recursively to parse
the sub-patterns within a tuple pattern.
Resolves #48492.
2018-02-25 04:41:16 +00:00
|
|
|
|
|
|
|
|
LL | if let b1, b2, b3 = reading_frame.next().unwrap() {
|
2019-01-30 04:50:44 +00:00
|
|
|
| ^
|
2019-10-24 05:20:58 +00:00
|
|
|
|
|
2022-01-12 20:43:24 +00:00
|
|
|
help: try adding parentheses to match on a tuple
|
2019-01-30 04:50:44 +00:00
|
|
|
|
|
|
|
|
LL | if let (b1, b2, b3) = reading_frame.next().unwrap() {
|
2022-01-12 20:43:24 +00:00
|
|
|
| + +
|
in which parentheses are suggested for should-have-been-tuple-patterns
Programmers used to working in some other languages (such as Python or
Go) might expect to be able to destructure values with comma-separated
identifiers but no parentheses on the left side of an assignment.
Previously, the first name in such code would get parsed as a
single-indentifier pattern—recognizing, for example, the
`let a` in `let a, b = (1, 2);`—whereupon we would have a fatal syntax
error on seeing an unexpected comma rather than the expected semicolon
(all the way nearer to the end of `parse_full_stmt`).
Instead, let's look for that comma when parsing the pattern, and if we
see it, momentarily make-believe that we're parsing the remaining
elements in a tuple pattern, so that we can suggest wrapping it all in
parentheses. We need to do this in a separate wrapper method called on
the top-level pattern (or `|`-patterns) in a `let` statement, `for`
loop, `if`- or `while let` expression, or match arm rather than within
`parse_pat` itself, because `parse_pat` gets called recursively to parse
the sub-patterns within a tuple pattern.
Resolves #48492.
2018-02-25 04:41:16 +00:00
|
|
|
|
|
|
|
error: unexpected `,` in pattern
|
2018-12-25 15:56:47 +00:00
|
|
|
--> $DIR/issue-48492-tuple-destructure-missing-parens.rs:59:28
|
in which parentheses are suggested for should-have-been-tuple-patterns
Programmers used to working in some other languages (such as Python or
Go) might expect to be able to destructure values with comma-separated
identifiers but no parentheses on the left side of an assignment.
Previously, the first name in such code would get parsed as a
single-indentifier pattern—recognizing, for example, the
`let a` in `let a, b = (1, 2);`—whereupon we would have a fatal syntax
error on seeing an unexpected comma rather than the expected semicolon
(all the way nearer to the end of `parse_full_stmt`).
Instead, let's look for that comma when parsing the pattern, and if we
see it, momentarily make-believe that we're parsing the remaining
elements in a tuple pattern, so that we can suggest wrapping it all in
parentheses. We need to do this in a separate wrapper method called on
the top-level pattern (or `|`-patterns) in a `let` statement, `for`
loop, `if`- or `while let` expression, or match arm rather than within
`parse_pat` itself, because `parse_pat` gets called recursively to parse
the sub-patterns within a tuple pattern.
Resolves #48492.
2018-02-25 04:41:16 +00:00
|
|
|
|
|
|
|
|
LL | Nucleotide::Adenine, Nucleotide::Cytosine, _ => true
|
2019-01-30 04:50:44 +00:00
|
|
|
| ^
|
2019-10-24 05:20:58 +00:00
|
|
|
|
|
2020-01-10 15:13:56 +00:00
|
|
|
help: try adding parentheses to match on a tuple...
|
2019-01-30 04:50:44 +00:00
|
|
|
|
|
|
|
|
LL | (Nucleotide::Adenine, Nucleotide::Cytosine, _) => true
|
2022-01-12 20:43:24 +00:00
|
|
|
| + +
|
2020-01-10 15:13:56 +00:00
|
|
|
help: ...or a vertical bar to match on multiple alternatives
|
2019-01-30 04:50:44 +00:00
|
|
|
|
|
|
|
|
LL | Nucleotide::Adenine | Nucleotide::Cytosine | _ => true
|
2021-06-22 02:07:19 +00:00
|
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
in which parentheses are suggested for should-have-been-tuple-patterns
Programmers used to working in some other languages (such as Python or
Go) might expect to be able to destructure values with comma-separated
identifiers but no parentheses on the left side of an assignment.
Previously, the first name in such code would get parsed as a
single-indentifier pattern—recognizing, for example, the
`let a` in `let a, b = (1, 2);`—whereupon we would have a fatal syntax
error on seeing an unexpected comma rather than the expected semicolon
(all the way nearer to the end of `parse_full_stmt`).
Instead, let's look for that comma when parsing the pattern, and if we
see it, momentarily make-believe that we're parsing the remaining
elements in a tuple pattern, so that we can suggest wrapping it all in
parentheses. We need to do this in a separate wrapper method called on
the top-level pattern (or `|`-patterns) in a `let` statement, `for`
loop, `if`- or `while let` expression, or match arm rather than within
`parse_pat` itself, because `parse_pat` gets called recursively to parse
the sub-patterns within a tuple pattern.
Resolves #48492.
2018-02-25 04:41:16 +00:00
|
|
|
|
|
|
|
error: unexpected `,` in pattern
|
2018-12-25 15:56:47 +00:00
|
|
|
--> $DIR/issue-48492-tuple-destructure-missing-parens.rs:67:10
|
in which parentheses are suggested for should-have-been-tuple-patterns
Programmers used to working in some other languages (such as Python or
Go) might expect to be able to destructure values with comma-separated
identifiers but no parentheses on the left side of an assignment.
Previously, the first name in such code would get parsed as a
single-indentifier pattern—recognizing, for example, the
`let a` in `let a, b = (1, 2);`—whereupon we would have a fatal syntax
error on seeing an unexpected comma rather than the expected semicolon
(all the way nearer to the end of `parse_full_stmt`).
Instead, let's look for that comma when parsing the pattern, and if we
see it, momentarily make-believe that we're parsing the remaining
elements in a tuple pattern, so that we can suggest wrapping it all in
parentheses. We need to do this in a separate wrapper method called on
the top-level pattern (or `|`-patterns) in a `let` statement, `for`
loop, `if`- or `while let` expression, or match arm rather than within
`parse_pat` itself, because `parse_pat` gets called recursively to parse
the sub-patterns within a tuple pattern.
Resolves #48492.
2018-02-25 04:41:16 +00:00
|
|
|
|
|
|
|
|
LL | for x, _barr_body in women.iter().map(|woman| woman.allosomes.clone()) {
|
2020-11-21 22:05:17 +00:00
|
|
|
| ^
|
|
|
|
|
|
2022-01-12 20:43:24 +00:00
|
|
|
help: try adding parentheses to match on a tuple
|
2020-11-21 22:05:17 +00:00
|
|
|
|
|
|
|
|
LL | for (x, _barr_body) in women.iter().map(|woman| woman.allosomes.clone()) {
|
2022-01-12 20:43:24 +00:00
|
|
|
| + +
|
in which parentheses are suggested for should-have-been-tuple-patterns
Programmers used to working in some other languages (such as Python or
Go) might expect to be able to destructure values with comma-separated
identifiers but no parentheses on the left side of an assignment.
Previously, the first name in such code would get parsed as a
single-indentifier pattern—recognizing, for example, the
`let a` in `let a, b = (1, 2);`—whereupon we would have a fatal syntax
error on seeing an unexpected comma rather than the expected semicolon
(all the way nearer to the end of `parse_full_stmt`).
Instead, let's look for that comma when parsing the pattern, and if we
see it, momentarily make-believe that we're parsing the remaining
elements in a tuple pattern, so that we can suggest wrapping it all in
parentheses. We need to do this in a separate wrapper method called on
the top-level pattern (or `|`-patterns) in a `let` statement, `for`
loop, `if`- or `while let` expression, or match arm rather than within
`parse_pat` itself, because `parse_pat` gets called recursively to parse
the sub-patterns within a tuple pattern.
Resolves #48492.
2018-02-25 04:41:16 +00:00
|
|
|
|
|
|
|
error: unexpected `,` in pattern
|
2018-12-25 15:56:47 +00:00
|
|
|
--> $DIR/issue-48492-tuple-destructure-missing-parens.rs:75:10
|
in which parentheses are suggested for should-have-been-tuple-patterns
Programmers used to working in some other languages (such as Python or
Go) might expect to be able to destructure values with comma-separated
identifiers but no parentheses on the left side of an assignment.
Previously, the first name in such code would get parsed as a
single-indentifier pattern—recognizing, for example, the
`let a` in `let a, b = (1, 2);`—whereupon we would have a fatal syntax
error on seeing an unexpected comma rather than the expected semicolon
(all the way nearer to the end of `parse_full_stmt`).
Instead, let's look for that comma when parsing the pattern, and if we
see it, momentarily make-believe that we're parsing the remaining
elements in a tuple pattern, so that we can suggest wrapping it all in
parentheses. We need to do this in a separate wrapper method called on
the top-level pattern (or `|`-patterns) in a `let` statement, `for`
loop, `if`- or `while let` expression, or match arm rather than within
`parse_pat` itself, because `parse_pat` gets called recursively to parse
the sub-patterns within a tuple pattern.
Resolves #48492.
2018-02-25 04:41:16 +00:00
|
|
|
|
|
|
|
|
LL | for x, y @ Allosome::Y(_) in men.iter().map(|man| man.allosomes.clone()) {
|
2020-11-21 22:05:17 +00:00
|
|
|
| ^
|
|
|
|
|
|
2022-01-12 20:43:24 +00:00
|
|
|
help: try adding parentheses to match on a tuple
|
2020-11-21 22:05:17 +00:00
|
|
|
|
|
|
|
|
LL | for (x, y @ Allosome::Y(_)) in men.iter().map(|man| man.allosomes.clone()) {
|
2022-01-12 20:43:24 +00:00
|
|
|
| + +
|
in which parentheses are suggested for should-have-been-tuple-patterns
Programmers used to working in some other languages (such as Python or
Go) might expect to be able to destructure values with comma-separated
identifiers but no parentheses on the left side of an assignment.
Previously, the first name in such code would get parsed as a
single-indentifier pattern—recognizing, for example, the
`let a` in `let a, b = (1, 2);`—whereupon we would have a fatal syntax
error on seeing an unexpected comma rather than the expected semicolon
(all the way nearer to the end of `parse_full_stmt`).
Instead, let's look for that comma when parsing the pattern, and if we
see it, momentarily make-believe that we're parsing the remaining
elements in a tuple pattern, so that we can suggest wrapping it all in
parentheses. We need to do this in a separate wrapper method called on
the top-level pattern (or `|`-patterns) in a `let` statement, `for`
loop, `if`- or `while let` expression, or match arm rather than within
`parse_pat` itself, because `parse_pat` gets called recursively to parse
the sub-patterns within a tuple pattern.
Resolves #48492.
2018-02-25 04:41:16 +00:00
|
|
|
|
|
|
|
error: unexpected `,` in pattern
|
2018-12-25 15:56:47 +00:00
|
|
|
--> $DIR/issue-48492-tuple-destructure-missing-parens.rs:84:14
|
in which parentheses are suggested for should-have-been-tuple-patterns
Programmers used to working in some other languages (such as Python or
Go) might expect to be able to destructure values with comma-separated
identifiers but no parentheses on the left side of an assignment.
Previously, the first name in such code would get parsed as a
single-indentifier pattern—recognizing, for example, the
`let a` in `let a, b = (1, 2);`—whereupon we would have a fatal syntax
error on seeing an unexpected comma rather than the expected semicolon
(all the way nearer to the end of `parse_full_stmt`).
Instead, let's look for that comma when parsing the pattern, and if we
see it, momentarily make-believe that we're parsing the remaining
elements in a tuple pattern, so that we can suggest wrapping it all in
parentheses. We need to do this in a separate wrapper method called on
the top-level pattern (or `|`-patterns) in a `let` statement, `for`
loop, `if`- or `while let` expression, or match arm rather than within
`parse_pat` itself, because `parse_pat` gets called recursively to parse
the sub-patterns within a tuple pattern.
Resolves #48492.
2018-02-25 04:41:16 +00:00
|
|
|
|
|
|
|
|
LL | let women, men: (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned()
|
2020-11-21 22:05:17 +00:00
|
|
|
| ^
|
|
|
|
|
|
2022-11-16 20:46:06 +00:00
|
|
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
|
2022-01-12 20:43:24 +00:00
|
|
|
help: try adding parentheses to match on a tuple
|
2020-11-21 22:05:17 +00:00
|
|
|
|
|
|
|
|
LL | let (women, men): (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned()
|
2022-01-12 20:43:24 +00:00
|
|
|
| + +
|
in which parentheses are suggested for should-have-been-tuple-patterns
Programmers used to working in some other languages (such as Python or
Go) might expect to be able to destructure values with comma-separated
identifiers but no parentheses on the left side of an assignment.
Previously, the first name in such code would get parsed as a
single-indentifier pattern—recognizing, for example, the
`let a` in `let a, b = (1, 2);`—whereupon we would have a fatal syntax
error on seeing an unexpected comma rather than the expected semicolon
(all the way nearer to the end of `parse_full_stmt`).
Instead, let's look for that comma when parsing the pattern, and if we
see it, momentarily make-believe that we're parsing the remaining
elements in a tuple pattern, so that we can suggest wrapping it all in
parentheses. We need to do this in a separate wrapper method called on
the top-level pattern (or `|`-patterns) in a `let` statement, `for`
loop, `if`- or `while let` expression, or match arm rather than within
`parse_pat` itself, because `parse_pat` gets called recursively to parse
the sub-patterns within a tuple pattern.
Resolves #48492.
2018-02-25 04:41:16 +00:00
|
|
|
|
|
|
|
error: aborting due to 6 previous errors
|
|
|
|
|