1
Fork 0

Rollup merge of #136435 - Zalathar:thir-pat-stuff, r=Nadrieril

Simplify some code for lowering THIR patterns

I've been playing around with some radically different ways of storing THIR patterns, and while those experiments haven't yet produced a clear win, I have noticed various smaller things in the existing code that can be made a bit nicer.

Some of the more significant changes:
- With a little bit of extra effort (and thoughtful use of Arc), we can completely remove an entire layer of `'pat` lifetimes from the intermediate data structures used for match lowering.
- In several places, lists of THIR patterns were being double-boxed for no apparent reason.
This commit is contained in:
Matthias Krüger 2025-02-06 13:10:00 +01:00 committed by GitHub
commit c9635e51b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 148 additions and 148 deletions

View file

@ -373,7 +373,8 @@ impl<'a, 'tcx> IsThirPolymorphic<'a, 'tcx> {
match pat.kind {
thir::PatKind::Constant { value } => value.has_non_region_param(),
thir::PatKind::Range(box thir::PatRange { lo, hi, .. }) => {
thir::PatKind::Range(ref range) => {
let &thir::PatRange { lo, hi, .. } = range.as_ref();
lo.has_non_region_param() || hi.has_non_region_param()
}
_ => false,