@@ -253,7 +253,7 @@ pub struct ParenthesizedArgs {
253
253
pub span : Span ,
254
254
255
255
/// `(A, B)`
256
- pub inputs : Vec < P < Ty > > ,
256
+ pub inputs : ThinVec < P < Ty > > ,
257
257
258
258
/// ```text
259
259
/// Foo(A, B) -> C
@@ -503,7 +503,7 @@ pub enum MetaItemKind {
503
503
/// List meta item.
504
504
///
505
505
/// E.g., `#[derive(..)]`, where the field represents the `..`.
506
- List ( Vec < NestedMetaItem > ) ,
506
+ List ( ThinVec < NestedMetaItem > ) ,
507
507
508
508
/// Name value meta item.
509
509
///
@@ -581,7 +581,7 @@ impl Pat {
581
581
// A tuple pattern `(P0, .., Pn)` can be reparsed as `(T0, .., Tn)`
582
582
// assuming `T0` to `Tn` are all syntactically valid as types.
583
583
PatKind :: Tuple ( pats) => {
584
- let mut tys = Vec :: with_capacity ( pats. len ( ) ) ;
584
+ let mut tys = ThinVec :: with_capacity ( pats. len ( ) ) ;
585
585
// FIXME(#48994) - could just be collected into an Option<Vec>
586
586
for pat in pats {
587
587
tys. push ( pat. to_ty ( ) ?) ;
@@ -725,11 +725,11 @@ pub enum PatKind {
725
725
Struct ( Option < P < QSelf > > , Path , Vec < PatField > , /* recovered */ bool ) ,
726
726
727
727
/// 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 > > ) ,
729
729
730
730
/// An or-pattern `A | B | C`.
731
731
/// Invariant: `pats.len() >= 2`.
732
- Or ( Vec < P < Pat > > ) ,
732
+ Or ( ThinVec < P < Pat > > ) ,
733
733
734
734
/// A possibly qualified path pattern.
735
735
/// Unqualified path patterns `A::B::C` can legally refer to variants, structs, constants
@@ -738,7 +738,7 @@ pub enum PatKind {
738
738
Path ( Option < P < QSelf > > , Path ) ,
739
739
740
740
/// A tuple pattern (`(a, b)`).
741
- Tuple ( Vec < P < Pat > > ) ,
741
+ Tuple ( ThinVec < P < Pat > > ) ,
742
742
743
743
/// A `box` pattern.
744
744
Box ( P < Pat > ) ,
@@ -753,7 +753,7 @@ pub enum PatKind {
753
753
Range ( Option < P < Expr > > , Option < P < Expr > > , Spanned < RangeEnd > ) ,
754
754
755
755
/// A slice pattern `[a, b, c]`.
756
- Slice ( Vec < P < Pat > > ) ,
756
+ Slice ( ThinVec < P < Pat > > ) ,
757
757
758
758
/// A rest pattern `..`.
759
759
///
@@ -1204,7 +1204,7 @@ impl Expr {
1204
1204
ExprKind :: Array ( exprs) if exprs. len ( ) == 1 => exprs[ 0 ] . to_ty ( ) . map ( TyKind :: Slice ) ?,
1205
1205
1206
1206
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 < _ > > > ( ) ?;
1208
1208
TyKind :: Tup ( tys)
1209
1209
}
1210
1210
@@ -1337,7 +1337,7 @@ pub struct MethodCall {
1337
1337
/// The receiver, e.g. `x`.
1338
1338
pub receiver : P < Expr > ,
1339
1339
/// The arguments, e.g. `a, b, c`.
1340
- pub args : Vec < P < Expr > > ,
1340
+ pub args : ThinVec < P < Expr > > ,
1341
1341
/// The span of the function, without the dot and receiver e.g. `foo::<Bar,
1342
1342
/// Baz>(a, b, c)`.
1343
1343
pub span : Span ,
@@ -1366,7 +1366,7 @@ pub enum ExprKind {
1366
1366
/// A `box x` expression.
1367
1367
Box ( P < Expr > ) ,
1368
1368
/// An array (`[a, b, c, d]`)
1369
- Array ( Vec < P < Expr > > ) ,
1369
+ Array ( ThinVec < P < Expr > > ) ,
1370
1370
/// Allow anonymous constants from an inline `const` block
1371
1371
ConstBlock ( AnonConst ) ,
1372
1372
/// A function call
@@ -1375,11 +1375,11 @@ pub enum ExprKind {
1375
1375
/// and the second field is the list of arguments.
1376
1376
/// This also represents calling the constructor of
1377
1377
/// tuple-like ADTs such as tuple structs and enum variants.
1378
- Call ( P < Expr > , Vec < P < Expr > > ) ,
1378
+ Call ( P < Expr > , ThinVec < P < Expr > > ) ,
1379
1379
/// A method call (e.g. `x.foo::<Bar, Baz>(a, b, c)`).
1380
1380
MethodCall ( Box < MethodCall > ) ,
1381
1381
/// A tuple (e.g., `(a, b, c, d)`).
1382
- Tup ( Vec < P < Expr > > ) ,
1382
+ Tup ( ThinVec < P < Expr > > ) ,
1383
1383
/// A binary operation (e.g., `a + b`, `a * b`).
1384
1384
Binary ( BinOp , P < Expr > , P < Expr > ) ,
1385
1385
/// A unary operation (e.g., `!x`, `*x`).
@@ -2078,7 +2078,7 @@ pub enum TyKind {
2078
2078
/// The never type (`!`).
2079
2079
Never ,
2080
2080
/// A tuple (`(A, B, C, D,...)`).
2081
- Tup ( Vec < P < Ty > > ) ,
2081
+ Tup ( ThinVec < P < Ty > > ) ,
2082
2082
/// A path (`module::module::...::Type`), optionally
2083
2083
/// "qualified", e.g., `<Vec<T> as SomeTrait>::SomeType`.
2084
2084
///
@@ -2363,7 +2363,7 @@ impl Param {
2363
2363
/// which contains metadata about function safety, asyncness, constness and ABI.
2364
2364
#[ derive( Clone , Encodable , Decodable , Debug ) ]
2365
2365
pub struct FnDecl {
2366
- pub inputs : Vec < Param > ,
2366
+ pub inputs : ThinVec < Param > ,
2367
2367
pub output : FnRetTy ,
2368
2368
}
2369
2369
@@ -2532,7 +2532,7 @@ pub enum UseTreeKind {
2532
2532
/// `use prefix` or `use prefix as rename`
2533
2533
Simple ( Option < Ident > ) ,
2534
2534
/// `use prefix::{...}`
2535
- Nested ( Vec < ( UseTree , NodeId ) > ) ,
2535
+ Nested ( ThinVec < ( UseTree , NodeId ) > ) ,
2536
2536
/// `use prefix::*`
2537
2537
Glob ,
2538
2538
}
@@ -2695,11 +2695,11 @@ pub enum VariantData {
2695
2695
/// Struct variant.
2696
2696
///
2697
2697
/// E.g., `Bar { .. }` as in `enum Foo { Bar { .. } }`.
2698
- Struct ( Vec < FieldDef > , bool ) ,
2698
+ Struct ( ThinVec < FieldDef > , bool ) ,
2699
2699
/// Tuple variant.
2700
2700
///
2701
2701
/// E.g., `Bar(..)` as in `enum Foo { Bar(..) }`.
2702
- Tuple ( Vec < FieldDef > , NodeId ) ,
2702
+ Tuple ( ThinVec < FieldDef > , NodeId ) ,
2703
2703
/// Unit variant.
2704
2704
///
2705
2705
/// E.g., `Bar = ..` as in `enum Foo { Bar = .. }`.
@@ -3122,8 +3122,8 @@ mod size_asserts {
3122
3122
static_assert_size ! ( GenericBound , 56 ) ;
3123
3123
static_assert_size ! ( Generics , 40 ) ;
3124
3124
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 ) ;
3127
3127
static_assert_size ! ( LitKind , 24 ) ;
3128
3128
static_assert_size ! ( Local , 72 ) ;
3129
3129
static_assert_size ! ( MetaItemLit , 40 ) ;
0 commit comments