Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid suggestion to use a vertical bar in let a, b = x; #61573

Closed
goffrie opened this issue Jun 6, 2019 · 3 comments
Closed

Invalid suggestion to use a vertical bar in let a, b = x; #61573

goffrie opened this issue Jun 6, 2019 · 3 comments
Labels
A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-bug Category: This is a bug. P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@goffrie
Copy link
Contributor

goffrie commented Jun 6, 2019

Introduced in #57008, the following program

fn main() {
    let a, b = x;
}

yields the following message:

error: unexpected `,` in pattern
 --> src/main.rs:2:10
  |
2 |     let a, b = x;
  |          ^
help: try adding parentheses to match on a tuple..
  |
2 |     let (a, b) = x;
  |         ^^^^^^
help: ..or a vertical bar to match on multiple alternatives
  |
2 |     let a | b = x;
  |         ^^^^^

However, the suggestion let a | b = x; is nonsensical.

@estebank estebank added A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-bug Category: This is a bug. P-medium Medium priority labels Jun 6, 2019
@petrochenkov
Copy link
Contributor

let a | b is supposed to work eventually (#48215, #54883), but it's not yet implemented.

@goffrie
Copy link
Contributor Author

goffrie commented Jun 7, 2019

I see. However, in this case, a | b would still not be a legal pattern.

@LeSeulArtichaut LeSeulArtichaut added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 7, 2020
@compiler-errors
Copy link
Member

This was resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-bug Category: This is a bug. P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants