From 54ea251bd40bec06c28e635371588e83cdacca9b Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Mon, 3 Jun 2019 00:54:33 +0800 Subject: Store referece in tokenbuffer --- crates/ra_mbe/src/subtree_parser.rs | 4 ++-- crates/ra_mbe/src/syntax_bridge.rs | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'crates/ra_mbe') diff --git a/crates/ra_mbe/src/subtree_parser.rs b/crates/ra_mbe/src/subtree_parser.rs index 1f12e42ef..4a6f6aa45 100644 --- a/crates/ra_mbe/src/subtree_parser.rs +++ b/crates/ra_mbe/src/subtree_parser.rs @@ -10,7 +10,7 @@ struct OffsetTokenSink<'a> { } impl<'a> OffsetTokenSink<'a> { - pub fn collect(&self, begin: Cursor<'a>) -> Vec { + pub fn collect(&self, begin: Cursor<'a>) -> Vec<&'a tt::TokenTree> { if !self.cursor.is_root() { return vec![]; } @@ -114,7 +114,7 @@ impl<'a> Parser<'a> { 1 => Some(res[0].clone()), _ => Some(tt::TokenTree::Subtree(tt::Subtree { delimiter: tt::Delimiter::None, - token_trees: res, + token_trees: res.into_iter().cloned().collect(), })), } } diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs index dce82f33d..0edb6f9a2 100644 --- a/crates/ra_mbe/src/syntax_bridge.rs +++ b/crates/ra_mbe/src/syntax_bridge.rs @@ -49,7 +49,8 @@ fn token_tree_to_syntax_node(tt: &tt::Subtree, f: F) -> Result