File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
src/tools/rust-analyzer/crates
hir-def/src/macro_expansion_tests/mbe Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -1144,3 +1144,27 @@ mod any {
11441144"# ] ] ,
11451145 ) ;
11461146}
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(
780780 // [1]: https://github.com/rust-lang/rust/blob/f0c4da499/compiler/rustc_expand/src/mbe/macro_parser.rs#L576
781781 match input. peek_n ( 0 ) {
782782 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 ) {
784784 it. sym == sym:: underscore || it. sym == sym:: let_ || it. sym == sym:: const_
785785 } else {
786786 it. sym == sym:: let_
You can’t perform that action at this time.
0 commit comments