diff options
Diffstat (limited to 'crates/mbe/src/expander')
-rw-r--r-- | crates/mbe/src/expander/matcher.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/mbe/src/expander/matcher.rs b/crates/mbe/src/expander/matcher.rs index b6782b4ba..75d2f2eed 100644 --- a/crates/mbe/src/expander/matcher.rs +++ b/crates/mbe/src/expander/matcher.rs | |||
@@ -304,7 +304,7 @@ impl BindingsBuilder { | |||
304 | link_nodes: &'a Vec<LinkNode<Rc<BindingKind>>>, | 304 | link_nodes: &'a Vec<LinkNode<Rc<BindingKind>>>, |
305 | nodes: &mut Vec<&'a Rc<BindingKind>>, | 305 | nodes: &mut Vec<&'a Rc<BindingKind>>, |
306 | ) { | 306 | ) { |
307 | link_nodes.into_iter().for_each(|it| match it { | 307 | link_nodes.iter().for_each(|it| match it { |
308 | LinkNode::Node(it) => nodes.push(it), | 308 | LinkNode::Node(it) => nodes.push(it), |
309 | LinkNode::Parent { idx, len } => self.collect_nodes_ref(*idx, *len, nodes), | 309 | LinkNode::Parent { idx, len } => self.collect_nodes_ref(*idx, *len, nodes), |
310 | }); | 310 | }); |
@@ -713,10 +713,9 @@ fn match_meta_var(kind: &str, input: &mut TtIter) -> ExpandResult<Option<Fragmen | |||
713 | .map(|ident| Some(tt::Leaf::from(ident.clone()).into())) | 713 | .map(|ident| Some(tt::Leaf::from(ident.clone()).into())) |
714 | .map_err(|()| err!("expected ident")), | 714 | .map_err(|()| err!("expected ident")), |
715 | "tt" => input.expect_tt().map(Some).map_err(|()| err!()), | 715 | "tt" => input.expect_tt().map(Some).map_err(|()| err!()), |
716 | "lifetime" => input | 716 | "lifetime" => { |
717 | .expect_lifetime() | 717 | input.expect_lifetime().map(Some).map_err(|()| err!("expected lifetime")) |
718 | .map(|tt| Some(tt)) | 718 | } |
719 | .map_err(|()| err!("expected lifetime")), | ||
720 | "literal" => { | 719 | "literal" => { |
721 | let neg = input.eat_char('-'); | 720 | let neg = input.eat_char('-'); |
722 | input | 721 | input |
@@ -762,7 +761,7 @@ impl<'a> TtIter<'a> { | |||
762 | fn expect_separator(&mut self, separator: &Separator, idx: usize) -> bool { | 761 | fn expect_separator(&mut self, separator: &Separator, idx: usize) -> bool { |
763 | let mut fork = self.clone(); | 762 | let mut fork = self.clone(); |
764 | let ok = match separator { | 763 | let ok = match separator { |
765 | Separator::Ident(lhs) if idx == 0 => match fork.expect_ident() { | 764 | Separator::Ident(lhs) if idx == 0 => match fork.expect_ident_or_underscore() { |
766 | Ok(rhs) => rhs.text == lhs.text, | 765 | Ok(rhs) => rhs.text == lhs.text, |
767 | _ => false, | 766 | _ => false, |
768 | }, | 767 | }, |
@@ -852,7 +851,7 @@ impl<'a> TtIter<'a> { | |||
852 | if punct.char != '\'' { | 851 | if punct.char != '\'' { |
853 | return Err(()); | 852 | return Err(()); |
854 | } | 853 | } |
855 | let ident = self.expect_ident()?; | 854 | let ident = self.expect_ident_or_underscore()?; |
856 | 855 | ||
857 | Ok(tt::Subtree { | 856 | Ok(tt::Subtree { |
858 | delimiter: None, | 857 | delimiter: None, |