summaryrefslogtreecommitdiffstats
path: root/tests/ui/let-else/let-else-destructuring.rs
blob: d1f1a69bfc2549d6263b4d5aca49ed7c7c09b6b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#[derive(Debug)]
enum Foo {
    Done,
    Nested(Option<&'static Foo>),
}

fn walk(mut value: &Foo) {
    loop {
        println!("{:?}", value);
        &Foo::Nested(Some(value)) = value else { break }; //~ ERROR invalid left-hand side of assignment
        //~^ERROR <assignment> ... else { ... } is not allowed
    }
}

fn main() {
    walk(&Foo::Done);
}