mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
18 lines
359 B
Rust
18 lines
359 B
Rust
|
#[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);
|
||
|
}
|