about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-03-29 02:40:54 +0100
committerGitHub <noreply@github.com>2019-03-29 02:40:54 +0100
commit73f9832ee46a84ad25320224fd5685f4c140c06d (patch)
tree09604bf26a04d6e6939399839c187fcd594add9a /src/libsyntax/parse
parentc2d6c08ebba2690ce2dc0305dd82a75b2b97289a (diff)
parent17a8aff20abdef46ae90801c85cc232e81443e1b (diff)
downloadrust-73f9832ee46a84ad25320224fd5685f4c140c06d.tar.gz
rust-73f9832ee46a84ad25320224fd5685f4c140c06d.zip
Rollup merge of #59476 - nnethercote:TokenStreamBuilder-SmallVec, r=petrochenkov
Use `SmallVec` in `TokenStreamBuilder`.

This reduces by 12% the number of allocations done for a "clean incremental" of `webrender_api`, which reduces the instruction count by about 0.5%.

r? @petrochenkov
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/attr.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index 4211268f33e..e99a86e807f 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -6,6 +6,7 @@ use crate::parse::parser::{Parser, TokenType, PathStyle};
 use crate::tokenstream::{TokenStream, TokenTree};
 
 use log::debug;
+use smallvec::smallvec;
 
 #[derive(Debug)]
 enum InnerAttributeParsePolicy<'a> {
@@ -171,7 +172,7 @@ impl<'a> Parser<'a> {
                 } else {
                     self.parse_unsuffixed_lit()?.tokens()
                 };
-                TokenStream::from_streams(vec![eq.into(), tokens])
+                TokenStream::from_streams(smallvec![eq.into(), tokens])
             } else {
                 TokenStream::empty()
             };