-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language teamRelevant to the language team
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
kornelski, popzxc, sffc, MinusGix, alexfoxgill and 4 moreebkalderon, eira-fransham, denisandroid, rickvanprim, RazrFalcon and 10 more
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language teamRelevant to the language team