diff options
| author | Cameron Steffen <cam.steffen94@gmail.com> | 2025-07-21 20:05:16 -0500 |
|---|---|---|
| committer | Cameron Steffen <cam.steffen94@gmail.com> | 2025-08-11 17:05:36 -0500 |
| commit | 5bc23ce25548d7f4a9f6ceaa48cc3d8fe7629f58 (patch) | |
| tree | 014fb073862c20373460e0eaa6989eb50a70fabc /compiler/rustc_ast/src/ast.rs | |
| parent | 3aa0ac0a8af32f2c5da106c5e89bd9712d5a9655 (diff) | |
| download | rust-5bc23ce25548d7f4a9f6ceaa48cc3d8fe7629f58.tar.gz rust-5bc23ce25548d7f4a9f6ceaa48cc3d8fe7629f58.zip | |
Extract ast TraitImplHeader
Diffstat (limited to 'compiler/rustc_ast/src/ast.rs')
| -rw-r--r-- | compiler/rustc_ast/src/ast.rs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 8160ed3cc46..87c9c797ea5 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -3661,15 +3661,19 @@ pub struct TyAlias { #[derive(Clone, Encodable, Decodable, Debug)] pub struct Impl { + pub generics: Generics, + pub of_trait: Option<Box<TraitImplHeader>>, + pub self_ty: Box<Ty>, + pub items: ThinVec<Box<AssocItem>>, +} + +#[derive(Clone, Encodable, Decodable, Debug)] +pub struct TraitImplHeader { pub defaultness: Defaultness, pub safety: Safety, - pub generics: Generics, pub constness: Const, pub polarity: ImplPolarity, - /// The trait being implemented, if any. - pub of_trait: Option<TraitRef>, - pub self_ty: Box<Ty>, - pub items: ThinVec<Box<AssocItem>>, + pub trait_ref: TraitRef, } #[derive(Clone, Encodable, Decodable, Debug, Default, Walkable)] @@ -3793,7 +3797,7 @@ pub enum ItemKind { /// An implementation. /// /// E.g., `impl<A> Foo<A> { .. }` or `impl<A> Trait for Foo<A> { .. }`. - Impl(Box<Impl>), + Impl(Impl), /// A macro invocation. /// /// E.g., `foo!(..)`. @@ -3880,7 +3884,7 @@ impl ItemKind { | Self::Union(_, generics, _) | Self::Trait(box Trait { generics, .. }) | Self::TraitAlias(_, generics, _) - | Self::Impl(box Impl { generics, .. }) => Some(generics), + | Self::Impl(Impl { generics, .. }) => Some(generics), _ => None, } } @@ -4040,7 +4044,7 @@ mod size_asserts { static_assert_size!(GenericArg, 24); static_assert_size!(GenericBound, 88); static_assert_size!(Generics, 40); - static_assert_size!(Impl, 136); + static_assert_size!(Impl, 64); static_assert_size!(Item, 144); static_assert_size!(ItemKind, 80); static_assert_size!(LitKind, 24); @@ -4053,6 +4057,7 @@ mod size_asserts { static_assert_size!(PathSegment, 24); static_assert_size!(Stmt, 32); static_assert_size!(StmtKind, 16); + static_assert_size!(TraitImplHeader, 80); static_assert_size!(Ty, 64); static_assert_size!(TyKind, 40); // tidy-alphabetical-end |
