Allowing `|` to be used within a sub-pattern would allow some match expressions on tuples and structs to be written much more clearly and concisely. For example, the following match expression: ``` rust match (x, y) { (A|B, C|D) => 0, _ => 1 } ``` would be equivalent to this expanded version: ``` rust match (x, y) { (A, C) => 0, (A, D) => 0, (B, C) => 0, (B, D) => 0, _ => 1 } ```
Activity
ftxqxd commentedon Sep 12, 2014
rust-lang/rfcs#99 proposed such an addition (among other things), but was postponed until post-1.0.
alexcrichton commentedon Sep 16, 2014
As @P1start mentioned, this is currently a postponed RFC, so I'm closing in favor of that.
mbrubeck commentedon Jul 8, 2017
rust-lang/rfcs#1882 is a more recent version of this request
mbrubeck commentedon May 21, 2018
rust-lang/rfcs#2175 addresses part of this feature.
mbrubeck commentedon Sep 26, 2018
New RFC for this feature: rust-lang/rfcs#2535.
mbrubeck commentedon May 3, 2021
Update: RFC 2535 was implemented and will become stable in Rust 1.53.
Auto merge of rust-lang#17180 - lnicola:bump-gh-pages, r=lnicola