mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 03:33:59 +00:00
Fix handling of attributes in positional field lists
This commit is contained in:
parent
e9e397e705
commit
0b9e462ab0
@ -140,6 +140,16 @@ fn pos_field_list(p: &mut Parser) {
|
||||
}
|
||||
while !p.at(R_PAREN) && !p.at(EOF) {
|
||||
let m = p.start();
|
||||
// test pos_field_attrs
|
||||
// struct S (
|
||||
// #[serde(with = "url_serde")]
|
||||
// pub Uri,
|
||||
// );
|
||||
//
|
||||
// enum S {
|
||||
// Uri(#[serde(with = "url_serde")] Uri),
|
||||
// }
|
||||
attributes::outer_attributes(p);
|
||||
opt_visibility(p);
|
||||
if !p.at_ts(types::TYPE_FIRST) {
|
||||
p.error("expected a type");
|
||||
|
@ -0,0 +1,4 @@
|
||||
struct S (
|
||||
#[serde(with = "url_serde")]
|
||||
pub Uri,
|
||||
);
|
@ -0,0 +1,39 @@
|
||||
SOURCE_FILE@[0; 60)
|
||||
STRUCT_DEF@[0; 59)
|
||||
STRUCT_KW@[0; 6)
|
||||
WHITESPACE@[6; 7)
|
||||
NAME@[7; 8)
|
||||
IDENT@[7; 8) "S"
|
||||
WHITESPACE@[8; 9)
|
||||
POS_FIELD_LIST@[9; 58)
|
||||
L_PAREN@[9; 10)
|
||||
WHITESPACE@[10; 15)
|
||||
POS_FIELD@[15; 55)
|
||||
ATTR@[15; 43)
|
||||
POUND@[15; 16)
|
||||
TOKEN_TREE@[16; 43)
|
||||
L_BRACK@[16; 17)
|
||||
IDENT@[17; 22) "serde"
|
||||
TOKEN_TREE@[22; 42)
|
||||
L_PAREN@[22; 23)
|
||||
IDENT@[23; 27) "with"
|
||||
WHITESPACE@[27; 28)
|
||||
EQ@[28; 29)
|
||||
WHITESPACE@[29; 30)
|
||||
STRING@[30; 41)
|
||||
R_PAREN@[41; 42)
|
||||
R_BRACK@[42; 43)
|
||||
WHITESPACE@[43; 48)
|
||||
VISIBILITY@[48; 51)
|
||||
PUB_KW@[48; 51)
|
||||
WHITESPACE@[51; 52)
|
||||
PATH_TYPE@[52; 55)
|
||||
PATH@[52; 55)
|
||||
PATH_SEGMENT@[52; 55)
|
||||
NAME_REF@[52; 55)
|
||||
IDENT@[52; 55) "Uri"
|
||||
COMMA@[55; 56)
|
||||
WHITESPACE@[56; 57)
|
||||
R_PAREN@[57; 58)
|
||||
SEMI@[58; 59)
|
||||
WHITESPACE@[59; 60)
|
Loading…
Reference in New Issue
Block a user