Skip to content

match do catch-22 #44087

Description

@durka

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:

#![feature(catch_expr)]

fn main() {
    match (do catch { }) { } //~WARN unnecessary parentheses around `match` head expression
    match do catch { } { } //~ERROR expected expression, found reserved keyword `do`
}

Why are the parens required anyway?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.F-try_blocks`#![feature(try_blocks)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions