mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Merge #6959
6959: Use pattern_single instead of pattern in mbe pat r=jonas-schievink a=edwin0cheng Fix #6882 Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
This commit is contained in:
commit
8eea4c9d3b
3 changed files with 14 additions and 2 deletions
|
@ -1003,6 +1003,18 @@ fn test_underscore() {
|
|||
.assert_expand_items(r#"foo! { => }"#, r#"0"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_vertical_bar_with_pat() {
|
||||
parse_macro(
|
||||
r#"
|
||||
macro_rules! foo {
|
||||
(| $pat:pat | ) => { 0 }
|
||||
}
|
||||
"#,
|
||||
)
|
||||
.assert_expand_items(r#"foo! { | x | }"#, r#"0"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_lifetime() {
|
||||
parse_macro(
|
||||
|
|
|
@ -55,7 +55,7 @@ pub(crate) mod fragments {
|
|||
use super::*;
|
||||
|
||||
pub(crate) use super::{
|
||||
expressions::block_expr, paths::type_path as path, patterns::pattern, types::type_,
|
||||
expressions::block_expr, paths::type_path as path, patterns::pattern_single, types::type_,
|
||||
};
|
||||
|
||||
pub(crate) fn expr(p: &mut Parser) {
|
||||
|
|
|
@ -112,7 +112,7 @@ pub fn parse_fragment(
|
|||
FragmentKind::Path => grammar::fragments::path,
|
||||
FragmentKind::Expr => grammar::fragments::expr,
|
||||
FragmentKind::Type => grammar::fragments::type_,
|
||||
FragmentKind::Pattern => grammar::fragments::pattern,
|
||||
FragmentKind::Pattern => grammar::fragments::pattern_single,
|
||||
FragmentKind::Item => grammar::fragments::item,
|
||||
FragmentKind::Block => grammar::fragments::block_expr,
|
||||
FragmentKind::Visibility => grammar::fragments::opt_visibility,
|
||||
|
|
Loading…
Reference in a new issue