parse const trait Trait
This commit is contained in:
@@ -4163,6 +4163,7 @@ impl<'hir> Item<'hir> {
|
||||
|
||||
expect_trait,
|
||||
(
|
||||
Constness,
|
||||
IsAuto,
|
||||
Safety,
|
||||
Ident,
|
||||
@@ -4170,8 +4171,8 @@ impl<'hir> Item<'hir> {
|
||||
GenericBounds<'hir>,
|
||||
&'hir [TraitItemId]
|
||||
),
|
||||
ItemKind::Trait(is_auto, safety, ident, generics, bounds, items),
|
||||
(*is_auto, *safety, *ident, generics, bounds, items);
|
||||
ItemKind::Trait(constness, is_auto, safety, ident, generics, bounds, items),
|
||||
(*constness, *is_auto, *safety, *ident, generics, bounds, items);
|
||||
|
||||
expect_trait_alias, (Ident, &'hir Generics<'hir>, GenericBounds<'hir>),
|
||||
ItemKind::TraitAlias(ident, generics, bounds), (*ident, generics, bounds);
|
||||
@@ -4341,7 +4342,15 @@ pub enum ItemKind<'hir> {
|
||||
/// A union definition, e.g., `union Foo<A, B> {x: A, y: B}`.
|
||||
Union(Ident, &'hir Generics<'hir>, VariantData<'hir>),
|
||||
/// A trait definition.
|
||||
Trait(IsAuto, Safety, Ident, &'hir Generics<'hir>, GenericBounds<'hir>, &'hir [TraitItemId]),
|
||||
Trait(
|
||||
Constness,
|
||||
IsAuto,
|
||||
Safety,
|
||||
Ident,
|
||||
&'hir Generics<'hir>,
|
||||
GenericBounds<'hir>,
|
||||
&'hir [TraitItemId],
|
||||
),
|
||||
/// A trait alias.
|
||||
TraitAlias(Ident, &'hir Generics<'hir>, GenericBounds<'hir>),
|
||||
|
||||
@@ -4385,7 +4394,7 @@ impl ItemKind<'_> {
|
||||
| ItemKind::Enum(ident, ..)
|
||||
| ItemKind::Struct(ident, ..)
|
||||
| ItemKind::Union(ident, ..)
|
||||
| ItemKind::Trait(_, _, ident, ..)
|
||||
| ItemKind::Trait(_, _, _, ident, ..)
|
||||
| ItemKind::TraitAlias(ident, ..) => Some(ident),
|
||||
|
||||
ItemKind::Use(_, UseKind::Glob | UseKind::ListStem)
|
||||
@@ -4403,7 +4412,7 @@ impl ItemKind<'_> {
|
||||
| ItemKind::Enum(_, generics, _)
|
||||
| ItemKind::Struct(_, generics, _)
|
||||
| ItemKind::Union(_, generics, _)
|
||||
| ItemKind::Trait(_, _, _, generics, _, _)
|
||||
| ItemKind::Trait(_, _, _, _, generics, _, _)
|
||||
| ItemKind::TraitAlias(_, generics, _)
|
||||
| ItemKind::Impl(Impl { generics, .. }) => generics,
|
||||
_ => return None,
|
||||
|
||||
@@ -618,7 +618,15 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) -> V::
|
||||
try_visit!(visitor.visit_generics(generics));
|
||||
try_visit!(visitor.visit_variant_data(struct_definition));
|
||||
}
|
||||
ItemKind::Trait(_is_auto, _safety, ident, ref generics, bounds, trait_item_refs) => {
|
||||
ItemKind::Trait(
|
||||
_constness,
|
||||
_is_auto,
|
||||
_safety,
|
||||
ident,
|
||||
ref generics,
|
||||
bounds,
|
||||
trait_item_refs,
|
||||
) => {
|
||||
try_visit!(visitor.visit_ident(ident));
|
||||
try_visit!(visitor.visit_generics(generics));
|
||||
walk_list!(visitor, visit_param_bound, bounds);
|
||||
|
||||
Reference in New Issue
Block a user