-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Variable labeling of complex match arms should be able to label the whole arm #673
Comments
👍. It would be much easier to use complex matching if you can label the whole arm at once. |
Just to be clear ... this is only an issue if you are working with data that is being moved into the arm's pattern, right? (Because otherwise you should just be able to bind the match's input to a variable at the outset, and then use that variable within the arm...) But maybe I a missing a use-case here. |
That's basically my use case. Having to define a variable outside of the match turns what could be a single expression (e.g., matching on the result of an expression) into a statement and expression. |
+1, just ran into this. |
This is a subset of #1882 |
Closing in favor of rust-lang/rust#54883. We already have |
Issue by Manishearth
Friday Jun 27, 2014 at 17:41 GMT
For earlier discussion, see rust-lang/rust#15219
This issue was labelled with: B-RFC, I-papercut in the Rust repository
If I have a match arm like this:
the following does not work:
In the former example, the
a
is bound to the first literal only, and in the latter the compiler thinks that it is a tuple (and complains about the lack of commas).Of course, one can do
but that is cumbersome.
Could we get a way to easily bind a variable to the entire match arm?
The text was updated successfully, but these errors were encountered: