Skip to content

Commit 3f7a086

Browse files
committed
Parse outer atttributes for RecordPatField
1 parent 70fe7a4 commit 3f7a086

File tree

3 files changed

+57
-8
lines changed

3 files changed

+57
-8
lines changed

crates/parser/src/grammar/patterns.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,15 @@ fn record_pat_field_list(p: &mut Parser) {
206206
T![.] if p.at(T![..]) => p.bump(T![..]),
207207
T!['{'] => error_block(p, "expected ident"),
208208

209-
c => {
209+
_ => {
210210
let m = p.start();
211-
match c {
211+
attributes::outer_attrs(p);
212+
match p.current() {
212213
// test record_pat_field
213214
// fn foo() {
214215
// let S { 0: 1 } = ();
215216
// let S { x: 1 } = ();
217+
// let S { #[cfg(any())] x: 1 } = ();
216218
// }
217219
IDENT | INT_NUMBER if p.nth(1) == T![:] => {
218220
name_ref_or_index(p);

crates/syntax/test_data/parser/inline/ok/0145_record_pat_field.rast

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
SOURCE_FILE@0..63
2-
FN@0..62
1+
SOURCE_FILE@0..102
2+
FN@0..101
33
44
55
@@ -8,7 +8,7 @@ [email protected]
88
99
1010
11-
BLOCK_EXPR@9..62
11+
BLOCK_EXPR@9..101
1212
1313
1414
@@ -70,6 +70,52 @@ [email protected]
7070
7171
7272
73-
74-
75-
73+
74+
75+
76+
77+
78+
79+
80+
81+
82+
83+
84+
85+
86+
87+
88+
89+
90+
91+
92+
93+
94+
95+
96+
97+
98+
99+
100+
101+
102+
103+
104+
105+
106+
107+
108+
109+
110+
111+
112+
113+
114+
115+
116+
117+
118+
119+
120+
121+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
fn foo() {
22
let S { 0: 1 } = ();
33
let S { x: 1 } = ();
4+
let S { #[cfg(any())] x: 1 } = ();
45
}

0 commit comments

Comments
 (0)