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/tests.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/tests.rs')
-rw-r--r-- | crates/mbe/src/tests.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/crates/mbe/src/tests.rs b/crates/mbe/src/tests.rs index 1d9afb4fb..d854985c5 100644 --- a/crates/mbe/src/tests.rs +++ b/crates/mbe/src/tests.rs | |||
@@ -1080,6 +1080,19 @@ fn test_vertical_bar_with_pat() { | |||
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | #[test] | 1082 | #[test] |
1083 | fn test_dollar_crate_lhs_is_not_meta() { | ||
1084 | parse_macro( | ||
1085 | r#" | ||
1086 | macro_rules! foo { | ||
1087 | ($crate) => {}; | ||
1088 | () => {0}; | ||
1089 | } | ||
1090 | "#, | ||
1091 | ) | ||
1092 | .assert_expand_items(r#"foo!{}"#, r#"0"#); | ||
1093 | } | ||
1094 | |||
1095 | #[test] | ||
1083 | fn test_lifetime() { | 1096 | fn test_lifetime() { |
1084 | parse_macro( | 1097 | parse_macro( |
1085 | r#" | 1098 | r#" |