]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #53304 - dtolnay:extend, r=dtolnay
authorbors <bors@rust-lang.org>
Thu, 16 Aug 2018 15:44:30 +0000 (15:44 +0000)
committerbors <bors@rust-lang.org>
Thu, 16 Aug 2018 15:44:30 +0000 (15:44 +0000)
TokenStream::extend

Two new insta-stable impls in libproc_macro:

```rust
impl Extend<TokenTree> for TokenStream
impl Extend<TokenStream> for TokenStream
```

`proc_macro::TokenStream` already implements `FromIterator<TokenTree>` and `FromIterator<TokenStream>` so I elected to support the same input types for `Extend`.

**This commit reduces compile time of Serde derives by 60% (takes less than half as long to compile)** as measured by building our test suite:

```console
$ git clone https://github.com/serde-rs/serde
$ cd serde/test_suite
$ cargo check --tests --features proc-macro2/nightly
$ rm -f ../target/debug/deps/libtest_*.rmeta
$ time cargo check --tests --features proc-macro2/nightly
Before: 20.8 seconds
After: 8.6 seconds
```

r? @alexcrichton

1  2 
src/libproc_macro/lib.rs
src/libsyntax/lib.rs

Simple merge
index c48ad0a802cb0470402f99154adea000f12c3e22,7e5b5db5e5a5dbed514c94af4187c1385a74676f..0a42325d2b6ff74a595cfbc0fac2d0ec3a66c9e9
@@@ -126,10 -122,17 +126,13 @@@ pub mod util 
      pub mod parser;
      #[cfg(test)]
      pub mod parser_testing;
 -    pub mod small_vector;
      pub mod move_map;
  
 -    mod thin_vec;
 -    pub use self::thin_vec::ThinVec;
 -
      mod rc_slice;
      pub use self::rc_slice::RcSlice;
+     mod rc_vec;
+     pub use self::rc_vec::RcVec;
  }
  
  pub mod json;