Closed
Description
Sub-tracking issue for rust-lang/rfcs#911.
This issue tracks integration of const fn
with pattern matching... For example:
#[derive(PartialEq, Eq)]
struct Foo { f: usize, g: usize }
const fn ZERO(x: usize) -> Foo { Foo { f: x, g: x } }
fn main() {
let f = Foo { f: 0, g: 1 };
match f {
ZERO(22) => println!("hi"),
_ => println!("1"),
}
}
This is currently not implemented:
error[E0532]: expected tuple struct/variant, found function `ZERO`
--> src/main.rs:11:9
|
11 | ZERO(22) => println!("hi"),
| ^^^^ not a tuple struct/variant
error: aborting due to previous error