diff options
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_ast/src/ast.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_builtin_macros/src/deriving/clone.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_builtin_macros/src/test.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_expand/src/build.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_expand/src/config.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_expand/src/module.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 4 |
8 files changed, 19 insertions, 18 deletions
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index de6a0b563eb..03c375c4666 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -471,7 +471,7 @@ pub struct WhereEqPredicate { #[derive(Clone, Encodable, Decodable, Debug)] pub struct Crate { pub attrs: AttrVec, - pub items: Vec<P<Item>>, + pub items: ThinVec<P<Item>>, pub spans: ModSpans, /// Must be equal to `CRATE_NODE_ID` after the crate root is expanded, but may hold /// expansion placeholders or an unassigned value (`DUMMY_NODE_ID`) before that. @@ -1357,7 +1357,7 @@ pub enum StructRest { pub struct StructExpr { pub qself: Option<P<QSelf>>, pub path: Path, - pub fields: Vec<ExprField>, + pub fields: ThinVec<ExprField>, pub rest: StructRest, } @@ -2475,7 +2475,7 @@ pub enum ModKind { /// or with definition outlined to a separate file `mod foo;` and already loaded from it. /// The inner span is from the first token past `{` to the last token until `}`, /// or from the first to the last token in the loaded file. - Loaded(Vec<P<Item>>, Inline, ModSpans), + Loaded(ThinVec<P<Item>>, Inline, ModSpans), /// Module with definition outlined to a separate file `mod foo;` but not yet loaded from it. Unloaded, } @@ -2502,7 +2502,7 @@ pub struct ForeignMod { #[derive(Clone, Encodable, Decodable, Debug)] pub struct EnumDef { - pub variants: Vec<Variant>, + pub variants: ThinVec<Variant>, } /// Enum variant. #[derive(Clone, Encodable, Decodable, Debug)] @@ -3122,8 +3122,8 @@ mod size_asserts { static_assert_size!(GenericBound, 56); static_assert_size!(Generics, 40); static_assert_size!(Impl, 136); - static_assert_size!(Item, 144); - static_assert_size!(ItemKind, 72); + static_assert_size!(Item, 136); + static_assert_size!(ItemKind, 64); static_assert_size!(LitKind, 24); static_assert_size!(Local, 72); static_assert_size!(MetaItemLit, 40); diff --git a/compiler/rustc_builtin_macros/src/deriving/clone.rs b/compiler/rustc_builtin_macros/src/deriving/clone.rs index 3c1abe02036..dfee2d3ce77 100644 --- a/compiler/rustc_builtin_macros/src/deriving/clone.rs +++ b/compiler/rustc_builtin_macros/src/deriving/clone.rs @@ -200,7 +200,7 @@ fn cs_clone( let call = subcall(cx, field); cx.field_imm(field.span, ident, call) }) - .collect::<Vec<_>>(); + .collect::<ThinVec<_>>(); cx.expr_struct(trait_span, ctor_path, fields) } diff --git a/compiler/rustc_builtin_macros/src/test.rs b/compiler/rustc_builtin_macros/src/test.rs index 608d8c96668..e02c7e6c01b 100644 --- a/compiler/rustc_builtin_macros/src/test.rs +++ b/compiler/rustc_builtin_macros/src/test.rs @@ -249,14 +249,14 @@ pub fn expand_test_or_bench( cx.expr_struct( sp, test_path("TestDescAndFn"), - vec![ + thin_vec![ // desc: test::TestDesc { field( "desc", cx.expr_struct( sp, test_path("TestDesc"), - vec![ + thin_vec![ // name: "path::to::test" field( "name", diff --git a/compiler/rustc_expand/src/build.rs b/compiler/rustc_expand/src/build.rs index eaecce91b8a..8a78c3296f9 100644 --- a/compiler/rustc_expand/src/build.rs +++ b/compiler/rustc_expand/src/build.rs @@ -323,7 +323,7 @@ impl<'a> ExtCtxt<'a> { &self, span: Span, path: ast::Path, - fields: Vec<ast::ExprField>, + fields: ThinVec<ast::ExprField>, ) -> P<ast::Expr> { self.expr( span, @@ -339,7 +339,7 @@ impl<'a> ExtCtxt<'a> { &self, span: Span, id: Ident, - fields: Vec<ast::ExprField>, + fields: ThinVec<ast::ExprField>, ) -> P<ast::Expr> { self.expr_struct(span, self.path_ident(span, id), fields) } diff --git a/compiler/rustc_expand/src/config.rs b/compiler/rustc_expand/src/config.rs index 5c845ae6d0b..01500c2c77c 100644 --- a/compiler/rustc_expand/src/config.rs +++ b/compiler/rustc_expand/src/config.rs @@ -24,6 +24,7 @@ use rustc_session::Session; use rustc_span::edition::{Edition, ALL_EDITIONS}; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{Span, DUMMY_SP}; +use thin_vec::ThinVec; /// A folder that strips out items that do not belong in the current configuration. pub struct StripUnconfigured<'a> { @@ -206,7 +207,7 @@ pub fn features( None => { // The entire crate is unconfigured. krate.attrs = ast::AttrVec::new(); - krate.items = Vec::new(); + krate.items = ThinVec::new(); Features::default() } Some(attrs) => { diff --git a/compiler/rustc_expand/src/module.rs b/compiler/rustc_expand/src/module.rs index 07f47a9c3a4..3779af19e12 100644 --- a/compiler/rustc_expand/src/module.rs +++ b/compiler/rustc_expand/src/module.rs @@ -12,8 +12,8 @@ use rustc_session::Session; use rustc_span::symbol::{sym, Ident}; use rustc_span::Span; use std::iter::once; - use std::path::{self, Path, PathBuf}; +use thin_vec::ThinVec; #[derive(Copy, Clone)] pub enum DirOwnership { @@ -31,7 +31,7 @@ pub struct ModulePathSuccess { } pub(crate) struct ParsedExternalMod { - pub items: Vec<P<Item>>, + pub items: ThinVec<P<Item>>, pub spans: ModSpans, pub file_path: PathBuf, pub dir_path: PathBuf, diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index c92379754bf..12f65a436e3 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -2935,8 +2935,8 @@ impl<'a> Parser<'a> { pth: ast::Path, recover: bool, close_delim: Delimiter, - ) -> PResult<'a, (Vec<ExprField>, ast::StructRest, bool)> { - let mut fields = Vec::new(); + ) -> PResult<'a, (ThinVec<ExprField>, ast::StructRest, bool)> { + let mut fields = ThinVec::new(); let mut base = ast::StructRest::None; let mut recover_async = false; diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 4e338f52f57..c0aed6a3789 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -56,12 +56,12 @@ impl<'a> Parser<'a> { pub fn parse_mod( &mut self, term: &TokenKind, - ) -> PResult<'a, (AttrVec, Vec<P<Item>>, ModSpans)> { + ) -> PResult<'a, (AttrVec, ThinVec<P<Item>>, ModSpans)> { let lo = self.token.span; let attrs = self.parse_inner_attributes()?; let post_attr_lo = self.token.span; - let mut items = vec![]; + let mut items = ThinVec::new(); while let Some(item) = self.parse_item(ForceCollect::No)? { items.push(item); self.maybe_consume_incorrect_semicolon(&items); |
