aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_proc_macro_srv/src/rustc_server.rs11
-rw-r--r--crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt3
2 files changed, 11 insertions, 3 deletions
diff --git a/crates/ra_proc_macro_srv/src/rustc_server.rs b/crates/ra_proc_macro_srv/src/rustc_server.rs
index ec0d35692..9fcfdc450 100644
--- a/crates/ra_proc_macro_srv/src/rustc_server.rs
+++ b/crates/ra_proc_macro_srv/src/rustc_server.rs
@@ -76,7 +76,16 @@ impl Extend<TokenTree> for TokenStream {
76impl Extend<TokenStream> for TokenStream { 76impl Extend<TokenStream> for TokenStream {
77 fn extend<I: IntoIterator<Item = TokenStream>>(&mut self, streams: I) { 77 fn extend<I: IntoIterator<Item = TokenStream>>(&mut self, streams: I) {
78 for item in streams { 78 for item in streams {
79 self.subtree.token_trees.extend(&mut item.into_iter()) 79 for tkn in item {
80 match tkn {
81 tt::TokenTree::Subtree(subtree) if subtree.delimiter.is_none() => {
82 self.subtree.token_trees.extend(subtree.token_trees);
83 }
84 _ => {
85 self.subtree.token_trees.push(tkn);
86 }
87 }
88 }
80 } 89 }
81 } 90 }
82} 91}
diff --git a/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt b/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt
index 24507d98d..1f5d940fa 100644
--- a/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt
+++ b/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt
@@ -25,8 +25,7 @@ SUBTREE $
25 SUBTREE () 4294967295 25 SUBTREE () 4294967295
26 IDENT feature 4294967295 26 IDENT feature 4294967295
27 PUNCH = [alone] 4294967295 27 PUNCH = [alone] 4294967295
28 SUBTREE $ 28 LITERAL "cargo-clippy" 0
29 LITERAL "cargo-clippy" 0
30 PUNCH , [alone] 4294967295 29 PUNCH , [alone] 4294967295
31 IDENT allow 4294967295 30 IDENT allow 4294967295
32 SUBTREE () 4294967295 31 SUBTREE () 4294967295