mirror of
https://gitee.com/openharmony/third_party_rust_syn
synced 2024-11-23 16:00:10 +00:00
Parse leading vert in nested patterns
This commit is contained in:
parent
ab13815dfe
commit
a82f5fafcd
@ -523,7 +523,7 @@ pub mod parsing {
|
||||
attrs,
|
||||
member,
|
||||
colon_token: input.parse()?,
|
||||
pat: Box::new(multi_pat(input)?),
|
||||
pat: Box::new(multi_pat_with_leading_vert(input)?),
|
||||
});
|
||||
}
|
||||
|
||||
@ -602,7 +602,7 @@ pub mod parsing {
|
||||
|
||||
let mut elems = Punctuated::new();
|
||||
while !content.is_empty() {
|
||||
let value = multi_pat(&content)?;
|
||||
let value = multi_pat_with_leading_vert(&content)?;
|
||||
elems.push_value(value);
|
||||
if content.is_empty() {
|
||||
break;
|
||||
@ -701,7 +701,7 @@ pub mod parsing {
|
||||
|
||||
let mut elems = Punctuated::new();
|
||||
while !content.is_empty() {
|
||||
let value = multi_pat(&content)?;
|
||||
let value = multi_pat_with_leading_vert(&content)?;
|
||||
elems.push_value(value);
|
||||
if content.is_empty() {
|
||||
break;
|
||||
|
@ -27,10 +27,6 @@ static EXCLUDE: &[&str] = &[
|
||||
"src/test/ui/const-generics/defaults/pretty-printing-ast.rs",
|
||||
"src/test/ui/const-generics/min_const_generics/type_and_const_defaults.rs",
|
||||
|
||||
// TODO: leading vert in or-pattern
|
||||
// https://github.com/dtolnay/syn/issues/982
|
||||
"src/test/ui/or-patterns/or-patterns-syntactic-pass.rs",
|
||||
|
||||
// TODO: static with omitted type
|
||||
// https://github.com/dtolnay/syn/issues/983
|
||||
// TODO: placeholder type in type parameter position
|
||||
|
@ -31,14 +31,14 @@ fn test_leading_vert() {
|
||||
syn::parse_str::<Item>("fn fun2(|| A: E) {}").unwrap_err();
|
||||
|
||||
syn::parse_str::<Stmt>("let | () = ();").unwrap();
|
||||
syn::parse_str::<Stmt>("let (| A): E;").unwrap_err();
|
||||
syn::parse_str::<Stmt>("let (| A): E;").unwrap();
|
||||
syn::parse_str::<Stmt>("let (|| A): (E);").unwrap_err();
|
||||
syn::parse_str::<Stmt>("let (| A,): (E,);").unwrap_err();
|
||||
syn::parse_str::<Stmt>("let [| A]: [E; 1];").unwrap_err();
|
||||
syn::parse_str::<Stmt>("let (| A,): (E,);").unwrap();
|
||||
syn::parse_str::<Stmt>("let [| A]: [E; 1];").unwrap();
|
||||
syn::parse_str::<Stmt>("let [|| A]: [E; 1];").unwrap_err();
|
||||
syn::parse_str::<Stmt>("let TS(| A): TS;").unwrap_err();
|
||||
syn::parse_str::<Stmt>("let TS(| A): TS;").unwrap();
|
||||
syn::parse_str::<Stmt>("let TS(|| A): TS;").unwrap_err();
|
||||
syn::parse_str::<Stmt>("let NS { f: | A }: NS;").unwrap_err();
|
||||
syn::parse_str::<Stmt>("let NS { f: | A }: NS;").unwrap();
|
||||
syn::parse_str::<Stmt>("let NS { f: || A }: NS;").unwrap_err();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user