]> git.lizzy.rs Git - rust.git/blob - src/test/ui/let-else/let-else-destructuring.rs
Rollup merge of #99479 - Enselic:import-can-be-without-id, r=camelid
[rust.git] / src / test / ui / let-else / let-else-destructuring.rs
1 #![feature(let_else)]
2 #[derive(Debug)]
3 enum Foo {
4     Done,
5     Nested(Option<&'static Foo>),
6 }
7
8 fn walk(mut value: &Foo) {
9     loop {
10         println!("{:?}", value);
11         &Foo::Nested(Some(value)) = value else { break }; //~ ERROR invalid left-hand side of assignment
12         //~^ERROR <assignment> ... else { ... } is not allowed
13     }
14 }
15
16 fn main() {
17     walk(&Foo::Done);
18 }