File tree 2 files changed +25
-1
lines changed
src/tools/rust-analyzer/crates
hir-def/src/macro_expansion_tests/mbe
2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -1144,3 +1144,27 @@ mod any {
1144
1144
"# ] ] ,
1145
1145
) ;
1146
1146
}
1147
+
1148
+ #[ test]
1149
+ fn regression_18148 ( ) {
1150
+ check (
1151
+ r#"
1152
+ macro_rules! m {
1153
+ ( $e:expr ) => {};
1154
+ }
1155
+
1156
+ fn foo() {
1157
+ m!(r#const);
1158
+ }
1159
+ "# ,
1160
+ expect ! [ [ r#"
1161
+ macro_rules! m {
1162
+ ( $e:expr ) => {};
1163
+ }
1164
+
1165
+ fn foo() {
1166
+ ;
1167
+ }
1168
+ "# ] ] ,
1169
+ ) ;
1170
+ }
Original file line number Diff line number Diff line change @@ -780,7 +780,7 @@ fn match_meta_var(
780
780
// [1]: https://github.com/rust-lang/rust/blob/f0c4da499/compiler/rustc_expand/src/mbe/macro_parser.rs#L576
781
781
match input. peek_n ( 0 ) {
782
782
Some ( tt:: TokenTree :: Leaf ( tt:: Leaf :: Ident ( it) ) ) => {
783
- let is_err = if matches ! ( expr, ExprKind :: Expr2021 ) {
783
+ let is_err = if it . is_raw . no ( ) && matches ! ( expr, ExprKind :: Expr2021 ) {
784
784
it. sym == sym:: underscore || it. sym == sym:: let_ || it. sym == sym:: const_
785
785
} else {
786
786
it. sym == sym:: let_
You can’t perform that action at this time.
0 commit comments