about summary refs log tree commit diff
path: root/src/libsyntax/diagnostics/plugin.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-09-26 10:04:42 +0000
committerbors <bors@rust-lang.org>2018-09-26 10:04:42 +0000
commitc3a1a0d3400bbbcac194efb6ef2b14eef9be5149 (patch)
tree0a75f20d6c5a9def5008fd24194e83946f9ac9db /src/libsyntax/diagnostics/plugin.rs
parenta2b27c19dad8b90063b56eff7b6433ba3f390d96 (diff)
parent130a32fa7259d348dc3a684b38e688da398c30bb (diff)
downloadrust-c3a1a0d3400bbbcac194efb6ef2b14eef9be5149.tar.gz
rust-c3a1a0d3400bbbcac194efb6ef2b14eef9be5149.zip
Auto merge of #53824 - ljedrz:begone_onevector, r=michaelwoerister
Remove OneVector, increase related SmallVec capacities

Removes the `OneVector` type alias (equivalent to `SmallVec<[T; 1]>`); it is used in scenarios where the capacity of 1 is often exceeded, which might be nullifying the performance wins (due to spilling to the heap) expected when using `SmallVec` instead of `Vec`.

The numbers I used in this PR are very rough estimates - it would probably be a good idea to adjust some/all of them, which is what this proposal is all about.

It might be a good idea to additionally create some local type aliases for the `SmallVec`s in the `Folder` trait, as they are repeated in quite a few spots; I'd be happy to apply this sort of adjustments.
Diffstat (limited to 'src/libsyntax/diagnostics/plugin.rs')
-rw-r--r--src/libsyntax/diagnostics/plugin.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs
index c5a2cd5ac0b..1229db9b0e0 100644
--- a/src/libsyntax/diagnostics/plugin.rs
+++ b/src/libsyntax/diagnostics/plugin.rs
@@ -19,7 +19,6 @@ use ext::base::{ExtCtxt, MacEager, MacResult};
 use ext::build::AstBuilder;
 use parse::token;
 use ptr::P;
-use OneVector;
 use symbol::{keywords, Symbol};
 use tokenstream::{TokenTree};
 
@@ -131,7 +130,7 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt,
     let sym = Ident::with_empty_ctxt(Symbol::gensym(&format!(
         "__register_diagnostic_{}", code
     )));
-    MacEager::items(OneVector::from_vec(vec![
+    MacEager::items(smallvec![
         ecx.item_mod(
             span,
             span,
@@ -139,7 +138,7 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt,
             Vec::new(),
             Vec::new()
         )
-    ]))
+    ])
 }
 
 pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt,
@@ -214,7 +213,7 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt,
         ),
     );
 
-    MacEager::items(OneVector::from_vec(vec![
+    MacEager::items(smallvec![
         P(ast::Item {
             ident: *name,
             attrs: Vec::new(),
@@ -227,5 +226,5 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt,
             span,
             tokens: None,
         })
-    ]))
+    ])
 }