1
Fork 0

Thread pattern types through the HIR

This commit is contained in:
Oli Scherer 2023-01-31 11:54:06 +00:00
parent c340e67dec
commit c4efc25bfa
15 changed files with 48 additions and 5 deletions

View file

@ -2624,6 +2624,8 @@ pub enum TyKind<'hir> {
Infer,
/// Placeholder for a type that has failed to be defined.
Err(rustc_span::ErrorGuaranteed),
/// Pattern types (`u32 as 1..`)
Pat(&'hir Ty<'hir>, &'hir Pat<'hir>),
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]

View file

@ -882,6 +882,10 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) -> V::Resul
TyKind::AnonAdt(item_id) => {
try_visit!(visitor.visit_nested_item(item_id));
}
TyKind::Pat(ty, pat) => {
try_visit!(visitor.visit_ty(ty));
try_visit!(visitor.visit_pat(pat));
}
}
V::Result::output()
}