Module rustc_mir_build::build::matches::simplify
source · Expand description
Simplifying Candidates
Simplifying a match pair place @ pattern
means breaking it down
into bindings or other, simpler match pairs. For example:
place @ (P1, P2)
can be simplified to[place.0 @ P1, place.1 @ P2]
place @ x
can be simplified to[]
by bindingx
toplace
The simplify_candidate
routine just repeatedly applies these
sort of simplifications until there is nothing left to
simplify. Match pairs cannot be simplified if they require some
sort of test: for example, testing which variant an enum is, or
testing a value against a constant.