Fix match literal

This commit is contained in:
Edwin Cheng
2019-05-20 18:29:02 +08:00
parent 3894eb77d8
commit ad9d2012de
2 changed files with 19 additions and 1 deletions

View File

@@ -281,7 +281,11 @@ fn match_lhs(pattern: &crate::Subtree, input: &mut TtCursor) -> Result<Bindings,
return Err(ExpandError::UnexpectedToken);
}
}
_ => return Err(ExpandError::UnexpectedToken),
crate::Leaf::Literal(literal) => {
if input.eat_literal().map(|i| &i.text) != Some(&literal.text) {
return Err(ExpandError::UnexpectedToken);
}
}
},
crate::TokenTree::Repeat(crate::Repeat { subtree, kind, separator }) => {
// Dirty hack to make macro-expansion terminate.