diff options
Diffstat (limited to 'crates/mbe/src/expander')
-rw-r--r-- | crates/mbe/src/expander/matcher.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/mbe/src/expander/matcher.rs b/crates/mbe/src/expander/matcher.rs index 3c53960ce..1682b21b0 100644 --- a/crates/mbe/src/expander/matcher.rs +++ b/crates/mbe/src/expander/matcher.rs | |||
@@ -710,7 +710,6 @@ fn match_meta_var(kind: &str, input: &mut TtIter) -> ExpandResult<Option<Fragmen | |||
710 | let tt_result = match kind { | 710 | let tt_result = match kind { |
711 | "ident" => input | 711 | "ident" => input |
712 | .expect_ident() | 712 | .expect_ident() |
713 | .and_then(|ident| if ident.text == "_" { Err(()) } else { Ok(ident) }) | ||
714 | .map(|ident| Some(tt::Leaf::from(ident.clone()).into())) | 713 | .map(|ident| Some(tt::Leaf::from(ident.clone()).into())) |
715 | .map_err(|()| err!("expected ident")), | 714 | .map_err(|()| err!("expected ident")), |
716 | "tt" => input.expect_tt().map(Some).map_err(|()| err!()), | 715 | "tt" => input.expect_tt().map(Some).map_err(|()| err!()), |
@@ -763,7 +762,7 @@ impl<'a> TtIter<'a> { | |||
763 | fn expect_separator(&mut self, separator: &Separator, idx: usize) -> bool { | 762 | fn expect_separator(&mut self, separator: &Separator, idx: usize) -> bool { |
764 | let mut fork = self.clone(); | 763 | let mut fork = self.clone(); |
765 | let ok = match separator { | 764 | let ok = match separator { |
766 | Separator::Ident(lhs) if idx == 0 => match fork.expect_ident() { | 765 | Separator::Ident(lhs) if idx == 0 => match fork.expect_ident_or_underscore() { |
767 | Ok(rhs) => rhs.text == lhs.text, | 766 | Ok(rhs) => rhs.text == lhs.text, |
768 | _ => false, | 767 | _ => false, |
769 | }, | 768 | }, |
@@ -853,7 +852,7 @@ impl<'a> TtIter<'a> { | |||
853 | if punct.char != '\'' { | 852 | if punct.char != '\'' { |
854 | return Err(()); | 853 | return Err(()); |
855 | } | 854 | } |
856 | let ident = self.expect_ident()?; | 855 | let ident = self.expect_ident_or_underscore()?; |
857 | 856 | ||
858 | Ok(tt::Subtree { | 857 | Ok(tt::Subtree { |
859 | delimiter: None, | 858 | delimiter: None, |