diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-08-17 12:34:33 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-08-22 07:35:33 +1000 |
| commit | 619b8abaa65efd7fcc05453381e532ed8b716cf0 (patch) | |
| tree | af5daccfb5d946c45ff0d60f2299533dcdea5490 /compiler/rustc_builtin_macros/src/proc_macro_harness.rs | |
| parent | 650bff80a623e17675ac72ae4d62ed200a4a3568 (diff) | |
| download | rust-619b8abaa65efd7fcc05453381e532ed8b716cf0.tar.gz rust-619b8abaa65efd7fcc05453381e532ed8b716cf0.zip | |
Use `AttrVec` in more places.
In some places we use `Vec<Attribute>` and some places we use `ThinVec<Attribute>` (a.k.a. `AttrVec`). This results in various points where we have to convert between `Vec` and `ThinVec`. This commit changes the places that use `Vec<Attribute>` to use `AttrVec`. A lot of this is mechanical and boring, but there are some interesting parts: - It adds a few new methods to `ThinVec`. - It implements `MapInPlace` for `ThinVec`, and introduces a macro to avoid the repetition of this trait for `Vec`, `SmallVec`, and `ThinVec`. Overall, it makes the code a little nicer, and has little effect on performance. But it is a precursor to removing `rustc_data_structures::thin_vec::ThinVec` and replacing it with `thin_vec::ThinVec`, which is implemented more efficiently.
Diffstat (limited to 'compiler/rustc_builtin_macros/src/proc_macro_harness.rs')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/proc_macro_harness.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_builtin_macros/src/proc_macro_harness.rs b/compiler/rustc_builtin_macros/src/proc_macro_harness.rs index 5cfda33491d..ebe1c3663e3 100644 --- a/compiler/rustc_builtin_macros/src/proc_macro_harness.rs +++ b/compiler/rustc_builtin_macros/src/proc_macro_harness.rs @@ -281,7 +281,7 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> { let span = DUMMY_SP.with_def_site_ctxt(expn_id.to_expn_id()); let proc_macro = Ident::new(sym::proc_macro, span); - let krate = cx.item(span, proc_macro, Vec::new(), ast::ItemKind::ExternCrate(None)); + let krate = cx.item(span, proc_macro, ast::AttrVec::new(), ast::ItemKind::ExternCrate(None)); let bridge = Ident::new(sym::bridge, span); let client = Ident::new(sym::client, span); |
