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-24 22:41:16 -06:00
|
|
|
error: unexpected `,` in pattern
|
2018-12-25 09:56:47 -06: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-24 22:41:16 -06:00
|
|
|
|
|
|
|
|
LL | while let b1, b2, b3 = reading_frame.next().expect("there should be a start codon") {
|
2022-01-12 14:43:24 -06:00
|
|
|
| ----- ^
|
|
|
|
| |
|
|
|
|
| while parsing the condition of this `while` expression
|
2019-10-24 00:20:58 -05:00
|
|
|
|
|
2022-01-12 14:43:24 -06:00
|
|
|
help: try adding parentheses to match on a tuple
|
2019-01-29 22:50:44 -06:00
|
|
|
|
|
|
|
|
LL | while let (b1, b2, b3) = reading_frame.next().expect("there should be a start codon") {
|
2022-01-12 14:43:24 -06: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-24 22:41:16 -06:00
|
|
|
|
|
|
|
error: unexpected `,` in pattern
|
2018-12-25 09:56:47 -06: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-24 22:41:16 -06:00
|
|
|
|
|
|
|
|
LL | if let b1, b2, b3 = reading_frame.next().unwrap() {
|
2019-01-29 22:50:44 -06:00
|
|
|
| ^
|
2019-10-24 00:20:58 -05:00
|
|
|
|
|
2022-01-12 14:43:24 -06:00
|
|
|
help: try adding parentheses to match on a tuple
|
2019-01-29 22:50:44 -06:00
|
|
|
|
|
|
|
|
LL | if let (b1, b2, b3) = reading_frame.next().unwrap() {
|
2022-01-12 14:43:24 -06: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-24 22:41:16 -06:00
|
|
|
|
|
|
|
error: unexpected `,` in pattern
|
2018-12-25 09:56:47 -06: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-24 22:41:16 -06:00
|
|
|
|
|
|
|
|
LL | Nucleotide::Adenine, Nucleotide::Cytosine, _ => true
|
2019-01-29 22:50:44 -06:00
|
|
|
| ^
|
2019-10-24 00:20:58 -05:00
|
|
|
|
|
2020-01-10 09:13:56 -06:00
|
|
|
help: try adding parentheses to match on a tuple...
|
2019-01-29 22:50:44 -06:00
|
|
|
|
|
|
|
|
LL | (Nucleotide::Adenine, Nucleotide::Cytosine, _) => true
|
2022-01-12 14:43:24 -06:00
|
|
|
| + +
|
2020-01-10 09:13:56 -06:00
|
|
|
help: ...or a vertical bar to match on multiple alternatives
|
2019-01-29 22:50:44 -06:00
|
|
|
|
|
|
|
|
LL | Nucleotide::Adenine | Nucleotide::Cytosine | _ => true
|
2021-06-21 21:07:19 -05: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-24 22:41:16 -06:00
|
|
|
|
|
|
|
error: unexpected `,` in pattern
|
2018-12-25 09:56:47 -06: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-24 22:41:16 -06:00
|
|
|
|
|
|
|
|
LL | for x, _barr_body in women.iter().map(|woman| woman.allosomes.clone()) {
|
2020-11-21 16:05:17 -06:00
|
|
|
| ^
|
|
|
|
|
|
2022-01-12 14:43:24 -06:00
|
|
|
help: try adding parentheses to match on a tuple
|
2020-11-21 16:05:17 -06:00
|
|
|
|
|
|
|
|
LL | for (x, _barr_body) in women.iter().map(|woman| woman.allosomes.clone()) {
|
2022-01-12 14:43:24 -06: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-24 22:41:16 -06:00
|
|
|
|
|
|
|
error: unexpected `,` in pattern
|
2018-12-25 09:56:47 -06: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-24 22:41:16 -06:00
|
|
|
|
|
|
|
|
LL | for x, y @ Allosome::Y(_) in men.iter().map(|man| man.allosomes.clone()) {
|
2020-11-21 16:05:17 -06:00
|
|
|
| ^
|
|
|
|
|
|
2022-01-12 14:43:24 -06:00
|
|
|
help: try adding parentheses to match on a tuple
|
2020-11-21 16:05:17 -06:00
|
|
|
|
|
|
|
|
LL | for (x, y @ Allosome::Y(_)) in men.iter().map(|man| man.allosomes.clone()) {
|
2022-01-12 14:43:24 -06: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-24 22:41:16 -06:00
|
|
|
|
|
|
|
error: unexpected `,` in pattern
|
2018-12-25 09:56:47 -06: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-24 22:41:16 -06:00
|
|
|
|
|
|
|
|
LL | let women, men: (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned()
|
2020-11-21 16:05:17 -06:00
|
|
|
| ^
|
|
|
|
|
|
2022-11-16 14:46:06 -06:00
|
|
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
|
2022-01-12 14:43:24 -06:00
|
|
|
help: try adding parentheses to match on a tuple
|
2020-11-21 16:05:17 -06:00
|
|
|
|
|
|
|
|
LL | let (women, men): (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned()
|
2022-01-12 14:43:24 -06: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-24 22:41:16 -06:00
|
|
|
|
|
|
|
error: aborting due to 6 previous errors
|
|
|
|
|