1
Fork 0

Remove 'pat lifetime from some match-lowering data structures

By storing `PatRange` in an Arc, and copying a few fields out of `Pat`, we can
greatly simplify the lifetimes involved in match lowering.
This commit is contained in:
Zalathar 2025-02-02 17:15:46 +11:00
parent ee17c3bc4d
commit 849e0364c1
8 changed files with 107 additions and 99 deletions

View file

@ -11,6 +11,7 @@
use std::cmp::Ordering;
use std::fmt;
use std::ops::Index;
use std::sync::Arc;
use rustc_abi::{FieldIdx, Integer, Size, VariantIdx};
use rustc_ast::{AsmMacro, InlineAsmOptions, InlineAsmTemplatePiece};
@ -846,7 +847,7 @@ pub enum PatKind<'tcx> {
subpattern: Box<Pat<'tcx>>,
},
Range(Box<PatRange<'tcx>>),
Range(Arc<PatRange<'tcx>>),
/// Matches against a slice, checking the length and extracting elements.
/// irrefutable when there is a slice pattern and both `prefix` and `suffix` are empty.