1
Fork 0

Rollup merge of #120331 - Nadrieril:no-arena, r=compiler-errors

pattern_analysis: use a plain `Vec` in `DeconstructedPat`

The use of an arena-allocated slice in `DeconstructedPat` dates to when we needed the arena anyway for lifetime reasons. Now that we don't, I'm thinking that if `thir::Pat` can use plain old `Vec`s, maybe so can I.

r? ```@ghost```
This commit is contained in:
Matthias Krüger 2024-02-06 22:45:40 +01:00 committed by GitHub
commit ce32d4862b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 61 additions and 64 deletions

View file

@ -13,7 +13,7 @@ use crate::{Captures, MatchArm, TypeCx};
#[derive(Debug)]
pub struct PatternColumn<'p, Cx: TypeCx> {
/// This must not contain an or-pattern. `expand_and_push` takes care to expand them.
patterns: Vec<&'p DeconstructedPat<'p, Cx>>,
patterns: Vec<&'p DeconstructedPat<Cx>>,
}
impl<'p, Cx: TypeCx> PatternColumn<'p, Cx> {
@ -41,7 +41,7 @@ impl<'p, Cx: TypeCx> PatternColumn<'p, Cx> {
pub fn head_ty(&self) -> Option<&Cx::Ty> {
self.patterns.first().map(|pat| pat.ty())
}
pub fn iter<'a>(&'a self) -> impl Iterator<Item = &'p DeconstructedPat<'p, Cx>> + Captures<'a> {
pub fn iter<'a>(&'a self) -> impl Iterator<Item = &'p DeconstructedPat<Cx>> + Captures<'a> {
self.patterns.iter().copied()
}