about summary refs log tree commit diff
path: root/compiler/rustc_expand/src/placeholders.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2022-08-17 12:34:33 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2022-08-22 07:35:33 +1000
commit619b8abaa65efd7fcc05453381e532ed8b716cf0 (patch)
treeaf5daccfb5d946c45ff0d60f2299533dcdea5490 /compiler/rustc_expand/src/placeholders.rs
parent650bff80a623e17675ac72ae4d62ed200a4a3568 (diff)
downloadrust-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_expand/src/placeholders.rs')
-rw-r--r--compiler/rustc_expand/src/placeholders.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_expand/src/placeholders.rs b/compiler/rustc_expand/src/placeholders.rs
index 48918541e72..3b0d5ddb97b 100644
--- a/compiler/rustc_expand/src/placeholders.rs
+++ b/compiler/rustc_expand/src/placeholders.rs
@@ -24,7 +24,7 @@ pub fn placeholder(
     }
 
     let ident = Ident::empty();
-    let attrs = Vec::new();
+    let attrs = ast::AttrVec::new();
     let vis = vis.unwrap_or(ast::Visibility {
         span: DUMMY_SP,
         kind: ast::VisibilityKind::Inherited,