Skip to content

Commit 8eea4c9

Browse files
Merge #6959
6959: Use pattern_single instead of pattern in mbe pat r=jonas-schievink a=edwin0cheng Fix #6882 Co-authored-by: Edwin Cheng <[email protected]>
2 parents eefbae7 + f942d10 commit 8eea4c9

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

crates/mbe/src/tests.rs

+12
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,18 @@ fn test_underscore() {
10031003
.assert_expand_items(r#"foo! { => }"#, r#"0"#);
10041004
}
10051005

1006+
#[test]
1007+
fn test_vertical_bar_with_pat() {
1008+
parse_macro(
1009+
r#"
1010+
macro_rules! foo {
1011+
(| $pat:pat | ) => { 0 }
1012+
}
1013+
"#,
1014+
)
1015+
.assert_expand_items(r#"foo! { | x | }"#, r#"0"#);
1016+
}
1017+
10061018
#[test]
10071019
fn test_lifetime() {
10081020
parse_macro(

crates/parser/src/grammar.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub(crate) mod fragments {
5555
use super::*;
5656

5757
pub(crate) use super::{
58-
expressions::block_expr, paths::type_path as path, patterns::pattern, types::type_,
58+
expressions::block_expr, paths::type_path as path, patterns::pattern_single, types::type_,
5959
};
6060

6161
pub(crate) fn expr(p: &mut Parser) {

crates/parser/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub fn parse_fragment(
112112
FragmentKind::Path => grammar::fragments::path,
113113
FragmentKind::Expr => grammar::fragments::expr,
114114
FragmentKind::Type => grammar::fragments::type_,
115-
FragmentKind::Pattern => grammar::fragments::pattern,
115+
FragmentKind::Pattern => grammar::fragments::pattern_single,
116116
FragmentKind::Item => grammar::fragments::item,
117117
FragmentKind::Block => grammar::fragments::block_expr,
118118
FragmentKind::Visibility => grammar::fragments::opt_visibility,

0 commit comments

Comments
 (0)