match lowering: Introduce a TestCase
enum to replace most matching on PatKind
by Nadrieril · Pull Request #121393 · rust-lang/rust (original) (raw)
Introduces TestCase
that represents the specific outcome of a test. It complements TestKind
which represents a test. In MatchPair::new()
we select the appropriate TestCase
for the pattern, and after that we almost never have to inspect the pattern directly during match lowering.
Together with #120904, this makes MatchPair
into a standalone abstraction that hides the details of thir::Pat
. This will become even truer in the next PR where I make TestCase
handle or patterns. This opens the door to a lot of future simplifications.