diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-18 20:36:37 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-18 20:36:37 +0100 |
commit | 7a59cd49ff2bb47fa0844fcf5f1ec44f32523b1b (patch) | |
tree | 2266a12f833d72faa4c4ba12a997999c7013e975 /crates/ra_mbe/src/mbe_expander/matcher.rs | |
parent | b95b77f92f4ce73b3c9cc652ac9ae40580d308ce (diff) | |
parent | a1b5cf81ebcac15299cc612b49023bb418507027 (diff) |
Merge #4035
4035: Convert bool to ident instead of literal in mbe r=matklad a=edwin0cheng
Fixed #1249
Currently we treat boolean literal as `tt::Literal` , which makes parsing $lit:lit matcher easily.
However, proc-macro2 treat boolean literal as `ident` :
https://github.com/alexcrichton/proc-macro2/blob/4173a21dc497c67326095e438ff989cc63cd9279/src/lib.rs#L939
OT: I am quite happy we finally need to fix this bug :)
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ra_mbe/src/mbe_expander/matcher.rs')
-rw-r--r-- | crates/ra_mbe/src/mbe_expander/matcher.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_mbe/src/mbe_expander/matcher.rs b/crates/ra_mbe/src/mbe_expander/matcher.rs index 9485c62b8..78f9efa1b 100644 --- a/crates/ra_mbe/src/mbe_expander/matcher.rs +++ b/crates/ra_mbe/src/mbe_expander/matcher.rs | |||
@@ -187,7 +187,11 @@ impl<'a> TtIter<'a> { | |||
187 | _ => false, | 187 | _ => false, |
188 | }, | 188 | }, |
189 | Separator::Literal(lhs) => match fork.expect_literal() { | 189 | Separator::Literal(lhs) => match fork.expect_literal() { |
190 | Ok(rhs) => rhs.text == lhs.text, | 190 | Ok(rhs) => match rhs { |
191 | tt::Leaf::Literal(rhs) => rhs.text == lhs.text, | ||
192 | tt::Leaf::Ident(rhs) => rhs.text == lhs.text, | ||
193 | tt::Leaf::Punct(_) => false, | ||
194 | }, | ||
191 | _ => false, | 195 | _ => false, |
192 | }, | 196 | }, |
193 | Separator::Puncts(lhss) => lhss.iter().all(|lhs| match fork.expect_punct() { | 197 | Separator::Puncts(lhss) => lhss.iter().all(|lhs| match fork.expect_punct() { |