]> git.lizzy.rs Git - rust.git/blob - tests/ui/let-else/let-else-destructuring.rs
Auto merge of #107843 - bjorn3:sync_cg_clif-2023-02-09, r=bjorn3
[rust.git] / tests / ui / let-else / let-else-destructuring.rs
1 #[derive(Debug)]
2 enum Foo {
3     Done,
4     Nested(Option<&'static Foo>),
5 }
6
7 fn walk(mut value: &Foo) {
8     loop {
9         println!("{:?}", value);
10         &Foo::Nested(Some(value)) = value else { break }; //~ ERROR invalid left-hand side of assignment
11         //~^ERROR <assignment> ... else { ... } is not allowed
12     }
13 }
14
15 fn main() {
16     walk(&Foo::Done);
17 }