-
Notifications
You must be signed in to change notification settings - Fork 13.3k
match do catch-22 #44087
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I think the original idea is to make this unambiguous? It was even checked in b1aa993. let catch = 5;
match catch { ... |
|
But struct init syntax is disallowed in a |
Then there's no ambiguity anyway. I don't understand the point of banning this. Maybe it's just been thrown in the large bin of "deal with this once we figure out how to get rid of |
This somehow got even worse: now (And in E2018, |
Given #54885 I'm labeling this a diagnostic problem. |
Updated code, still lints on the unused parens but errors without them.
|
This now compiles: #![feature(try_blocks)]
fn main() {
match try { Ok::<_, ()>(0) } {
Ok(_) => {},
Err(()) => {}
}
} |
It seems that you need to add parentheses in order to put a
catch
expression in a match head, but if you do, you get a warning:Why are the parens required anyway?
The text was updated successfully, but these errors were encountered: