- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTF-destructuring_assignment`#![feature(destructuring_assignment)]``#![feature(destructuring_assignment)]`F-let_elseIssues related to let-else statements (RFC 3137)Issues related to let-else statements (RFC 3137)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
#![feature(let_else)]
#[derive(Debug)]
enum Foo {
    Done,
    Nested(Option<&'static Foo>),
}
fn walk(mut value: &Foo) {
    loop {
        println!("{:?}", value);
        &Foo::Nested(Some(value)) = value else { break };
    }
}results in
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found keyword `else`
  --> src/lib.rs:11:36
   |
11 |         Foo::Nested(value) = value else { break };
   |                                    ^^^^ expected one of 8 possible tokens
i.e. a general parser error. This should either be supported and compile, or get a better error.
iago-lito, CryZe and anderskFishrock123
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTF-destructuring_assignment`#![feature(destructuring_assignment)]``#![feature(destructuring_assignment)]`F-let_elseIssues related to let-else statements (RFC 3137)Issues related to let-else statements (RFC 3137)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.