Remove boxes from ast TyPat lists

This commit is contained in:
Cameron Steffen 2025-09-04 20:00:46 -05:00
parent c44500b4a1
commit 703584604a
3 changed files with 6 additions and 6 deletions

View file

@ -2579,7 +2579,7 @@ pub enum TyPatKind {
/// A range pattern (e.g., `1...2`, `1..2`, `1..`, `..2`, `1..=2`, `..=2`).
Range(Option<Box<AnonConst>>, Option<Box<AnonConst>>, Spanned<RangeEnd>),
Or(ThinVec<Box<TyPat>>),
Or(ThinVec<TyPat>),
/// Placeholder for a pattern that wasn't syntactically well formed in some way.
Err(ErrorGuaranteed),

View file

@ -391,7 +391,7 @@ macro_rules! common_visitor_and_walkers {
ThinVec<PreciseCapturingArg>,
ThinVec<Pat>,
ThinVec<Box<Ty>>,
ThinVec<Box<TyPat>>,
ThinVec<TyPat>,
);
// This macro generates `impl Visitable` and `impl MutVisitable` that forward to `Walkable`

View file

@ -44,14 +44,14 @@ fn parse_pat_ty<'a>(
parser.unexpected()?;
}
Ok((ty, pat))
Ok((ty, Box::new(pat)))
}
fn ty_pat(kind: TyPatKind, span: Span) -> Box<TyPat> {
Box::new(TyPat { id: DUMMY_NODE_ID, kind, span, tokens: None })
fn ty_pat(kind: TyPatKind, span: Span) -> TyPat {
TyPat { id: DUMMY_NODE_ID, kind, span, tokens: None }
}
fn pat_to_ty_pat(cx: &mut ExtCtxt<'_>, pat: ast::Pat) -> Box<TyPat> {
fn pat_to_ty_pat(cx: &mut ExtCtxt<'_>, pat: ast::Pat) -> TyPat {
let kind = match pat.kind {
ast::PatKind::Range(start, end, include_end) => TyPatKind::Range(
start.map(|value| Box::new(AnonConst { id: DUMMY_NODE_ID, value })),