tczajka
1
This works:
enum X {
A,
B,
}
fn f(x: Option<X>) {
match x {
Some(X::A) => {}
Some(X::B) => {}
None => {}
}
}
But this doesn't work:
enum X {
}
fn f(x: Option<X>) {
match x {
None => {}
}
}
error[E0004]: non-exhaustive patterns: `Some(_)` not covered
--> src/lib.rs:5:11
|
5 | match x {
| ^ pattern `Some(_)` not covered
|
It has been solved in beta(1.82) : Rust Playground
10 Likes
chrefr
3
On stable, the way to solve is as follows:
enum X {
}
fn f(x: Option<X>) {
match x {
Some(v) => match v {},
None => {}
}
}
5 Likes