# Summary We allow using (some) constants in patterns. However, we cannot allow all of them: some just don't have a way of being compared, such as unions; others get rejected for being "not structural-match", as defined in [RFC 1445][rfc-1445]. The structural-match check had some holes so some constants that we do accept get linted as "this will be an error in the future". These lints were introduced [a long time ago](https://github.com/rust-lang/rust/pull/62339) and have been [warn-by-default](https://github.com/rust-lang/rust/pull/70743) since Rust 1.48, close to 3 years ago. Since then the pattern matching implementation in the compiler changed *a lot* and our ideas of what we do and don't want to do with pattern matching also changed. We also realized there are some gaps in what the RFC discusses, such as raw pointers. [rfc-1445]: https://rust-lang.github.io/rfcs/1445-restrict-constants-in-patterns.html It's time to figure out where we want to go with this. # Background reading Design meeting document: https://hackmd.io/@CV5q1SRASEuY8WfOgd_3iQ/rk-b3D6Ja Some relevant related issues: - https://github.com/rust-lang/rust/issues/74446 - https://github.com/rust-lang/rust/issues/41620 - https://github.com/rust-lang/rust/issues/62411 - https://github.com/rust-lang/rust/issues/70861 - https://github.com/rust-lang/rust/issues/73448 - https://github.com/rust-lang/rust/issues/115881 - https://github.com/rust-lang/rust/issues/116122 # About this issue This issue corresponds to a [lang-team design meeting proposal]. It corresponds to a possible topic of discussion that may be scheduled for deeper discussion during one of our design meetings. [lang-team design meeting proposal]: https://lang-team.rust-lang.org/meetings/design.html