diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-08 06:03:54 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-08 06:03:54 +0000 |
commit | be02ac981de88869a9d6069b675a78a2e9e31f99 (patch) | |
tree | cfdfe11e7d4d6b50350679ab6cff67bd64dd90a4 /crates/mbe/src/parser.rs | |
parent | 1a29934c37cf4ffa2b269c39a25245e58d3916d5 (diff) | |
parent | bced02c5dc636c7b88aeadf9eefa66f8cf06103e (diff) |
Merge #7205
7205: Fix bug for $crate in LHS of mbe r=edwin0cheng a=edwin0cheng
We treated `$crate` as meta variable in LHS of mbe, which should be an `ident`.
Fixes #7204
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/mbe/src/parser.rs')
-rw-r--r-- | crates/mbe/src/parser.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/mbe/src/parser.rs b/crates/mbe/src/parser.rs index 77cc739b6..f3047972d 100644 --- a/crates/mbe/src/parser.rs +++ b/crates/mbe/src/parser.rs | |||
@@ -109,6 +109,10 @@ fn next_op<'a>(first: &tt::TokenTree, src: &mut TtIter<'a>, mode: Mode) -> Resul | |||
109 | let id = punct.id; | 109 | let id = punct.id; |
110 | Op::Var { name, kind, id } | 110 | Op::Var { name, kind, id } |
111 | } | 111 | } |
112 | tt::Leaf::Ident(ident) if ident.text == "crate" => { | ||
113 | // We simply produce identifier `$crate` here. And it will be resolved when lowering ast to Path. | ||
114 | Op::Leaf(tt::Leaf::from(tt::Ident { text: "$crate".into(), id: ident.id })) | ||
115 | } | ||
112 | tt::Leaf::Ident(ident) => { | 116 | tt::Leaf::Ident(ident) => { |
113 | let name = ident.text.clone(); | 117 | let name = ident.text.clone(); |
114 | let kind = eat_fragment_kind(src, mode)?; | 118 | let kind = eat_fragment_kind(src, mode)?; |