Skip to content

Commit

Permalink
Auto merge of #119688 - Nadrieril:dont-alloc-custom-wildcards, r=comp…
Browse files Browse the repository at this point in the history
…iler-errors

Exhaustiveness: use an `Option` instead of allocating fictitious patterns

In the process of exhaustiveness checking, `Matrix` stores a 2D array of patterns. Those are subpatterns of the patterns we were provided as input, _except_ sometimes we allocate some extra wildcard patterns to fill a hole during specialization.

Morally though, we could store `Option<&'p DeconstructedPat>` in the matrix, where `None` signifies a wildcard. That way we'd only have "real" patterns in the matrix and we wouldn't need the arena to allocate these wildcards. This is what this PR does.

This is part of me splitting up rust-lang/rust#119581 for ease of review.

r? `@compiler-errors`
  • Loading branch information
bors committed Jan 11, 2024
2 parents 992788b + 048daa5 commit 87d126c
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 87d126c

Please sign in to comment.