]> git.proxmox.com Git - rustc.git/blob - src/test/ui/let-else/let-else-destructuring.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / 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 }