diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index e2236b3ef828e..3c8d9140b0093 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -2435,7 +2435,7 @@ pub struct ForeignMod { /// semantically by Rust. pub unsafety: Unsafe, pub abi: Option, - pub items: Vec>, + pub items: ThinVec>, } #[derive(Clone, Encodable, Decodable, Debug)] @@ -2753,7 +2753,7 @@ pub struct Trait { pub is_auto: IsAuto, pub generics: Generics, pub bounds: GenericBounds, - pub items: Vec>, + pub items: ThinVec>, } /// The location of a where clause on a `TyAlias` (`Span`) and whether there was @@ -2801,7 +2801,7 @@ pub struct Impl { /// The trait being implemented, if any. pub of_trait: Option, pub self_ty: P, - pub items: Vec>, + pub items: ThinVec>, } #[derive(Clone, Encodable, Decodable, Debug)] @@ -3047,7 +3047,7 @@ mod size_asserts { static_assert_size!(ForeignItemKind, 24); static_assert_size!(GenericBound, 56); static_assert_size!(Generics, 40); - static_assert_size!(Impl, 152); + static_assert_size!(Impl, 136); static_assert_size!(Item, 152); static_assert_size!(ItemKind, 80); static_assert_size!(Lit, 48); diff --git a/compiler/rustc_builtin_macros/src/deriving/mod.rs b/compiler/rustc_builtin_macros/src/deriving/mod.rs index a65d0bad6de80..9039c15a1fb62 100644 --- a/compiler/rustc_builtin_macros/src/deriving/mod.rs +++ b/compiler/rustc_builtin_macros/src/deriving/mod.rs @@ -6,6 +6,7 @@ use rustc_ast::{GenericArg, Impl, ItemKind, MetaItem}; use rustc_expand::base::{Annotatable, ExpandResult, ExtCtxt, MultiItemModifier}; use rustc_span::symbol::{sym, Ident, Symbol}; use rustc_span::Span; +use thin_vec::ThinVec; macro path_local($x:ident) { generic::ty::Path::new_local(sym::$x) @@ -187,7 +188,7 @@ fn inject_impl_of_structural_trait( generics, of_trait: Some(trait_ref), self_ty: self_type, - items: Vec::new(), + items: ThinVec::new(), })), ); diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index e77c4f9be023b..58175c37a1786 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -663,12 +663,12 @@ impl<'a> Parser<'a> { &mut self, attrs: &mut AttrVec, mut parse_item: impl FnMut(&mut Parser<'a>) -> PResult<'a, Option>>, - ) -> PResult<'a, Vec> { + ) -> PResult<'a, ThinVec> { let open_brace_span = self.token.span; self.expect(&token::OpenDelim(Delimiter::Brace))?; attrs.extend(self.parse_inner_attributes()?); - let mut items = Vec::new(); + let mut items = ThinVec::new(); while !self.eat(&token::CloseDelim(Delimiter::Brace)) { if self.recover_doc_comment_before_brace() { continue;