Use ThinVec in various AST types.

This commit changes the sequence parsers to produce `ThinVec`, which
triggers numerous conversions.
This commit is contained in:
Nicholas Nethercote 2022-11-23 11:55:16 +11:00
parent 6a56c3a930
commit 4143b101f9
52 changed files with 355 additions and 292 deletions

View file

@ -29,10 +29,11 @@ use rustc_span::source_map::SourceMap;
use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::{BytePos, FileName, Span, DUMMY_SP};
use smallvec::{smallvec, SmallVec};
use std::default::Default;
use std::iter;
use std::path::{Path, PathBuf};
use std::rc::Rc;
use thin_vec::ThinVec;
pub(crate) use rustc_span::hygiene::MacroKind;
@ -554,7 +555,7 @@ impl DummyResult {
pub fn raw_expr(sp: Span, is_error: bool) -> P<ast::Expr> {
P(ast::Expr {
id: ast::DUMMY_NODE_ID,
kind: if is_error { ast::ExprKind::Err } else { ast::ExprKind::Tup(Vec::new()) },
kind: if is_error { ast::ExprKind::Err } else { ast::ExprKind::Tup(ThinVec::new()) },
span: sp,
attrs: ast::AttrVec::new(),
tokens: None,
@ -570,7 +571,7 @@ impl DummyResult {
pub fn raw_ty(sp: Span, is_error: bool) -> P<ast::Ty> {
P(ast::Ty {
id: ast::DUMMY_NODE_ID,
kind: if is_error { ast::TyKind::Err } else { ast::TyKind::Tup(Vec::new()) },
kind: if is_error { ast::TyKind::Err } else { ast::TyKind::Tup(ThinVec::new()) },
span: sp,
tokens: None,
})