X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_expand%2Fsrc%2Fbuild.rs;h=e17cba1478ab6e939eb3153cf76565e4dffb3446;hb=fce077b05362bee14d01335e52bd6b6b9cf88682;hp=0952e65cfee3d590b3643a1d2d96a33acfacd190;hpb=9f3786b2b1f3450c796041175f08a7cae7da42f3;p=rust.git diff --git a/compiler/rustc_expand/src/build.rs b/compiler/rustc_expand/src/build.rs index 0952e65cfee..e17cba1478a 100644 --- a/compiler/rustc_expand/src/build.rs +++ b/compiler/rustc_expand/src/build.rs @@ -1,13 +1,12 @@ use crate::base::ExtCtxt; - use rustc_ast::attr; use rustc_ast::ptr::P; use rustc_ast::{self as ast, AttrVec, BlockCheckMode, Expr, LocalKind, PatKind, UnOp}; use rustc_data_structures::sync::Lrc; use rustc_span::source_map::Spanned; use rustc_span::symbol::{kw, sym, Ident, Symbol}; - use rustc_span::Span; +use thin_vec::ThinVec; impl<'a> ExtCtxt<'a> { pub fn path(&self, span: Span, strs: Vec) -> ast::Path { @@ -28,7 +27,7 @@ pub fn path_all( ) -> ast::Path { assert!(!idents.is_empty()); let add_root = global && !idents[0].is_path_segment_keyword(); - let mut segments = Vec::with_capacity(idents.len() + add_root as usize); + let mut segments = ThinVec::with_capacity(idents.len() + add_root as usize); if add_root { segments.push(ast::PathSegment::path_root(span)); } @@ -334,8 +333,8 @@ pub fn expr_struct_ident( } fn expr_lit(&self, span: Span, lit_kind: ast::LitKind) -> P { - let lit = ast::Lit::from_lit_kind(lit_kind, span); - self.expr(span, ast::ExprKind::Lit(lit)) + let token_lit = lit_kind.to_token_lit(); + self.expr(span, ast::ExprKind::Lit(token_lit)) } pub fn expr_usize(&self, span: Span, i: usize) -> P { @@ -532,15 +531,15 @@ pub fn lambda(&self, span: Span, ids: Vec, body: P) -> P