`, `0`,
@@ -252,7 +253,7 @@ pub struct ParenthesizedArgs {
pub span: Span,
/// `(A, B)`
- pub inputs: Vec>,
+ pub inputs: ThinVec
>,
/// ```text
/// Foo(A, B) -> C
@@ -383,7 +384,7 @@ impl GenericParam {
/// a function, enum, trait, etc.
#[derive(Clone, Encodable, Decodable, Debug)]
pub struct Generics {
- pub params: Vec,
+ pub params: ThinVec,
pub where_clause: WhereClause,
pub span: Span,
}
@@ -391,7 +392,7 @@ pub struct Generics {
impl Default for Generics {
/// Creates an instance of `Generics`.
fn default() -> Generics {
- Generics { params: Vec::new(), where_clause: Default::default(), span: DUMMY_SP }
+ Generics { params: ThinVec::new(), where_clause: Default::default(), span: DUMMY_SP }
}
}
@@ -402,13 +403,13 @@ pub struct WhereClause {
/// if we parsed no predicates (e.g. `struct Foo where {}`).
/// This allows us to pretty-print accurately.
pub has_where_token: bool,
- pub predicates: Vec,
+ pub predicates: ThinVec,
pub span: Span,
}
impl Default for WhereClause {
fn default() -> WhereClause {
- WhereClause { has_where_token: false, predicates: Vec::new(), span: DUMMY_SP }
+ WhereClause { has_where_token: false, predicates: ThinVec::new(), span: DUMMY_SP }
}
}
@@ -440,7 +441,7 @@ impl WherePredicate {
pub struct WhereBoundPredicate {
pub span: Span,
/// Any generics from a `for` binding.
- pub bound_generic_params: Vec,
+ pub bound_generic_params: ThinVec,
/// The type being bounded.
pub bounded_ty: P,
/// Trait and lifetime bounds (`Clone + Send + 'static`).
@@ -470,7 +471,7 @@ pub struct WhereEqPredicate {
#[derive(Clone, Encodable, Decodable, Debug)]
pub struct Crate {
pub attrs: AttrVec,
- pub items: Vec>,
+ pub items: ThinVec
>,
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.
@@ -502,7 +503,7 @@ pub enum MetaItemKind {
/// List meta item.
///
/// E.g., `#[derive(..)]`, where the field represents the `..`.
- List(Vec),
+ List(ThinVec),
/// Name value meta item.
///
@@ -530,7 +531,7 @@ pub enum NestedMetaItem {
#[derive(Clone, Encodable, Decodable, Debug)]
pub struct Block {
/// The statements in the block.
- pub stmts: Vec,
+ pub stmts: ThinVec,
pub id: NodeId,
/// Distinguishes between `unsafe { ... }` and `{ ... }`.
pub rules: BlockCheckMode,
@@ -580,7 +581,7 @@ impl Pat {
// A tuple pattern `(P0, .., Pn)` can be reparsed as `(T0, .., Tn)`
// assuming `T0` to `Tn` are all syntactically valid as types.
PatKind::Tuple(pats) => {
- let mut tys = Vec::with_capacity(pats.len());
+ let mut tys = ThinVec::with_capacity(pats.len());
// FIXME(#48994) - could just be collected into an Option
for pat in pats {
tys.push(pat.to_ty()?);
@@ -721,14 +722,14 @@ pub enum PatKind {
/// A struct or struct variant pattern (e.g., `Variant {x, y, ..}`).
/// The `bool` is `true` in the presence of a `..`.
- Struct(Option>, Path, Vec, /* recovered */ bool),
+ Struct(Option>, Path, ThinVec, /* recovered */ bool),
/// A tuple struct/variant pattern (`Variant(x, y, .., z)`).
- TupleStruct(Option>, Path, Vec
>),
+ TupleStruct(Option
>, Path, ThinVec
>),
/// An or-pattern `A | B | C`.
/// Invariant: `pats.len() >= 2`.
- Or(Vec
>),
+ Or(ThinVec
>),
/// A possibly qualified path pattern.
/// Unqualified path patterns `A::B::C` can legally refer to variants, structs, constants
@@ -737,7 +738,7 @@ pub enum PatKind {
Path(Option
>, Path),
/// A tuple pattern (`(a, b)`).
- Tuple(Vec
>),
+ Tuple(ThinVec
>),
/// A `box` pattern.
Box(P),
@@ -752,7 +753,7 @@ pub enum PatKind {
Range(Option>, Option
>, Spanned),
/// A slice pattern `[a, b, c]`.
- Slice(Vec>),
+ Slice(ThinVec
>),
/// A rest pattern `..`.
///
@@ -1168,7 +1169,7 @@ impl Expr {
pub fn to_bound(&self) -> Option {
match &self.kind {
ExprKind::Path(None, path) => Some(GenericBound::Trait(
- PolyTraitRef::new(Vec::new(), path.clone(), self.span),
+ PolyTraitRef::new(ThinVec::new(), path.clone(), self.span),
TraitBoundModifier::None,
)),
_ => None,
@@ -1203,7 +1204,7 @@ impl Expr {
ExprKind::Array(exprs) if exprs.len() == 1 => exprs[0].to_ty().map(TyKind::Slice)?,
ExprKind::Tup(exprs) => {
- let tys = exprs.iter().map(|expr| expr.to_ty()).collect::