@@ -253,7 +253,7 @@ pub struct ParenthesizedArgs {
253253 pub span : Span ,
254254
255255 /// `(A, B)`
256- pub inputs : Vec < P < Ty > > ,
256+ pub inputs : ThinVec < P < Ty > > ,
257257
258258 /// ```text
259259 /// Foo(A, B) -> C
@@ -503,7 +503,7 @@ pub enum MetaItemKind {
503503 /// List meta item.
504504 ///
505505 /// E.g., `#[derive(..)]`, where the field represents the `..`.
506- List ( Vec < NestedMetaItem > ) ,
506+ List ( ThinVec < NestedMetaItem > ) ,
507507
508508 /// Name value meta item.
509509 ///
@@ -581,7 +581,7 @@ impl Pat {
581581 // A tuple pattern `(P0, .., Pn)` can be reparsed as `(T0, .., Tn)`
582582 // assuming `T0` to `Tn` are all syntactically valid as types.
583583 PatKind :: Tuple ( pats) => {
584- let mut tys = Vec :: with_capacity ( pats. len ( ) ) ;
584+ let mut tys = ThinVec :: with_capacity ( pats. len ( ) ) ;
585585 // FIXME(#48994) - could just be collected into an Option<Vec>
586586 for pat in pats {
587587 tys. push ( pat. to_ty ( ) ?) ;
@@ -725,11 +725,11 @@ pub enum PatKind {
725725 Struct ( Option < P < QSelf > > , Path , Vec < PatField > , /* recovered */ bool ) ,
726726
727727 /// A tuple struct/variant pattern (`Variant(x, y, .., z)`).
728- TupleStruct ( Option < P < QSelf > > , Path , Vec < P < Pat > > ) ,
728+ TupleStruct ( Option < P < QSelf > > , Path , ThinVec < P < Pat > > ) ,
729729
730730 /// An or-pattern `A | B | C`.
731731 /// Invariant: `pats.len() >= 2`.
732- Or ( Vec < P < Pat > > ) ,
732+ Or ( ThinVec < P < Pat > > ) ,
733733
734734 /// A possibly qualified path pattern.
735735 /// Unqualified path patterns `A::B::C` can legally refer to variants, structs, constants
@@ -738,7 +738,7 @@ pub enum PatKind {
738738 Path ( Option < P < QSelf > > , Path ) ,
739739
740740 /// A tuple pattern (`(a, b)`).
741- Tuple ( Vec < P < Pat > > ) ,
741+ Tuple ( ThinVec < P < Pat > > ) ,
742742
743743 /// A `box` pattern.
744744 Box ( P < Pat > ) ,
@@ -753,7 +753,7 @@ pub enum PatKind {
753753 Range ( Option < P < Expr > > , Option < P < Expr > > , Spanned < RangeEnd > ) ,
754754
755755 /// A slice pattern `[a, b, c]`.
756- Slice ( Vec < P < Pat > > ) ,
756+ Slice ( ThinVec < P < Pat > > ) ,
757757
758758 /// A rest pattern `..`.
759759 ///
@@ -1204,7 +1204,7 @@ impl Expr {
12041204 ExprKind :: Array ( exprs) if exprs. len ( ) == 1 => exprs[ 0 ] . to_ty ( ) . map ( TyKind :: Slice ) ?,
12051205
12061206 ExprKind :: Tup ( exprs) => {
1207- let tys = exprs. iter ( ) . map ( |expr| expr. to_ty ( ) ) . collect :: < Option < Vec < _ > > > ( ) ?;
1207+ let tys = exprs. iter ( ) . map ( |expr| expr. to_ty ( ) ) . collect :: < Option < ThinVec < _ > > > ( ) ?;
12081208 TyKind :: Tup ( tys)
12091209 }
12101210
@@ -1337,7 +1337,7 @@ pub struct MethodCall {
13371337 /// The receiver, e.g. `x`.
13381338 pub receiver : P < Expr > ,
13391339 /// The arguments, e.g. `a, b, c`.
1340- pub args : Vec < P < Expr > > ,
1340+ pub args : ThinVec < P < Expr > > ,
13411341 /// The span of the function, without the dot and receiver e.g. `foo::<Bar,
13421342 /// Baz>(a, b, c)`.
13431343 pub span : Span ,
@@ -1366,7 +1366,7 @@ pub enum ExprKind {
13661366 /// A `box x` expression.
13671367 Box ( P < Expr > ) ,
13681368 /// An array (`[a, b, c, d]`)
1369- Array ( Vec < P < Expr > > ) ,
1369+ Array ( ThinVec < P < Expr > > ) ,
13701370 /// Allow anonymous constants from an inline `const` block
13711371 ConstBlock ( AnonConst ) ,
13721372 /// A function call
@@ -1375,11 +1375,11 @@ pub enum ExprKind {
13751375 /// and the second field is the list of arguments.
13761376 /// This also represents calling the constructor of
13771377 /// tuple-like ADTs such as tuple structs and enum variants.
1378- Call ( P < Expr > , Vec < P < Expr > > ) ,
1378+ Call ( P < Expr > , ThinVec < P < Expr > > ) ,
13791379 /// A method call (e.g. `x.foo::<Bar, Baz>(a, b, c)`).
13801380 MethodCall ( Box < MethodCall > ) ,
13811381 /// A tuple (e.g., `(a, b, c, d)`).
1382- Tup ( Vec < P < Expr > > ) ,
1382+ Tup ( ThinVec < P < Expr > > ) ,
13831383 /// A binary operation (e.g., `a + b`, `a * b`).
13841384 Binary ( BinOp , P < Expr > , P < Expr > ) ,
13851385 /// A unary operation (e.g., `!x`, `*x`).
@@ -2078,7 +2078,7 @@ pub enum TyKind {
20782078 /// The never type (`!`).
20792079 Never ,
20802080 /// A tuple (`(A, B, C, D,...)`).
2081- Tup ( Vec < P < Ty > > ) ,
2081+ Tup ( ThinVec < P < Ty > > ) ,
20822082 /// A path (`module::module::...::Type`), optionally
20832083 /// "qualified", e.g., `<Vec<T> as SomeTrait>::SomeType`.
20842084 ///
@@ -2363,7 +2363,7 @@ impl Param {
23632363/// which contains metadata about function safety, asyncness, constness and ABI.
23642364#[ derive( Clone , Encodable , Decodable , Debug ) ]
23652365pub struct FnDecl {
2366- pub inputs : Vec < Param > ,
2366+ pub inputs : ThinVec < Param > ,
23672367 pub output : FnRetTy ,
23682368}
23692369
@@ -2532,7 +2532,7 @@ pub enum UseTreeKind {
25322532 /// `use prefix` or `use prefix as rename`
25332533 Simple ( Option < Ident > ) ,
25342534 /// `use prefix::{...}`
2535- Nested ( Vec < ( UseTree , NodeId ) > ) ,
2535+ Nested ( ThinVec < ( UseTree , NodeId ) > ) ,
25362536 /// `use prefix::*`
25372537 Glob ,
25382538}
@@ -2695,11 +2695,11 @@ pub enum VariantData {
26952695 /// Struct variant.
26962696 ///
26972697 /// E.g., `Bar { .. }` as in `enum Foo { Bar { .. } }`.
2698- Struct ( Vec < FieldDef > , bool ) ,
2698+ Struct ( ThinVec < FieldDef > , bool ) ,
26992699 /// Tuple variant.
27002700 ///
27012701 /// E.g., `Bar(..)` as in `enum Foo { Bar(..) }`.
2702- Tuple ( Vec < FieldDef > , NodeId ) ,
2702+ Tuple ( ThinVec < FieldDef > , NodeId ) ,
27032703 /// Unit variant.
27042704 ///
27052705 /// E.g., `Bar = ..` as in `enum Foo { Bar = .. }`.
@@ -3122,8 +3122,8 @@ mod size_asserts {
31223122 static_assert_size ! ( GenericBound , 56 ) ;
31233123 static_assert_size ! ( Generics , 40 ) ;
31243124 static_assert_size ! ( Impl , 136 ) ;
3125- static_assert_size ! ( Item , 152 ) ;
3126- static_assert_size ! ( ItemKind , 80 ) ;
3125+ static_assert_size ! ( Item , 144 ) ;
3126+ static_assert_size ! ( ItemKind , 72 ) ;
31273127 static_assert_size ! ( LitKind , 24 ) ;
31283128 static_assert_size ! ( Local , 72 ) ;
31293129 static_assert_size ! ( MetaItemLit , 40 ) ;
0 commit comments