diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:50 +0000 |
commit | 2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35 (patch) | |
tree | d325add32978dbdc1db975a438b3a77d571b1ab8 /compiler/rustc_builtin_macros/src/proc_macro_harness.rs | |
parent | Releasing progress-linux version 1.68.2+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.tar.xz rustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.zip |
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_builtin_macros/src/proc_macro_harness.rs')
-rw-r--r-- | compiler/rustc_builtin_macros/src/proc_macro_harness.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/rustc_builtin_macros/src/proc_macro_harness.rs b/compiler/rustc_builtin_macros/src/proc_macro_harness.rs index 21c8caa65..bc513607d 100644 --- a/compiler/rustc_builtin_macros/src/proc_macro_harness.rs +++ b/compiler/rustc_builtin_macros/src/proc_macro_harness.rs @@ -11,6 +11,7 @@ use rustc_span::symbol::{kw, sym, Ident, Symbol}; use rustc_span::{Span, DUMMY_SP}; use smallvec::smallvec; use std::mem; +use thin_vec::{thin_vec, ThinVec}; struct ProcMacroDerive { id: NodeId, @@ -314,11 +315,14 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> { cx.expr_call( span, proc_macro_ty_method_path(cx, custom_derive), - vec![ + thin_vec![ cx.expr_str(span, cd.trait_name), cx.expr_array_ref( span, - cd.attrs.iter().map(|&s| cx.expr_str(span, s)).collect::<Vec<_>>(), + cd.attrs + .iter() + .map(|&s| cx.expr_str(span, s)) + .collect::<ThinVec<_>>(), ), local_path(cx, cd.function_name), ], @@ -335,7 +339,7 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> { cx.expr_call( span, proc_macro_ty_method_path(cx, ident), - vec![ + thin_vec![ cx.expr_str(span, ca.function_name.name), local_path(cx, ca.function_name), ], @@ -371,13 +375,13 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> { }); let block = cx.expr_block( - cx.block(span, vec![cx.stmt_item(span, krate), cx.stmt_item(span, decls_static)]), + cx.block(span, thin_vec![cx.stmt_item(span, krate), cx.stmt_item(span, decls_static)]), ); let anon_constant = cx.item_const( span, Ident::new(kw::Underscore, span), - cx.ty(span, ast::TyKind::Tup(Vec::new())), + cx.ty(span, ast::TyKind::Tup(ThinVec::new())), block, ); |