(Re-)Implement impl_trait_in_bindings

This commit is contained in:
Michael Goulet 2024-12-11 22:18:39 +00:00
parent 1da411e750
commit d714a22e7b
45 changed files with 391 additions and 25 deletions

View file

@ -2906,6 +2906,8 @@ pub enum TyKind<'hir> {
Path(QPath<'hir>),
/// An opaque type definition itself. This is only used for `impl Trait`.
OpaqueDef(&'hir OpaqueTy<'hir>),
/// A trait ascription type, which is `impl Trait` within a local binding.
TraitAscription(GenericBounds<'hir>),
/// A trait object type `Bound1 + Bound2 + Bound3`
/// where `Bound` is a trait or a lifetime.
TraitObject(&'hir [PolyTraitRef<'hir>], &'hir Lifetime, TraitObjectSyntax),

View file

@ -900,6 +900,9 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) -> V::Resul
TyKind::OpaqueDef(opaque) => {
try_visit!(visitor.visit_opaque_ty(opaque));
}
TyKind::TraitAscription(bounds) => {
walk_list!(visitor, visit_param_bound, bounds);
}
TyKind::Array(ref ty, ref length) => {
try_visit!(visitor.visit_ty(ty));
try_visit!(visitor.visit_const_arg(length));