rustc: Don't ignore attributes inside empty mods. Closes #1655
This commit is contained in:
parent
ffa77dd610
commit
27ab663845
2 changed files with 18 additions and 1 deletions
|
@ -2068,7 +2068,6 @@ fn parse_mod_items(p: parser, term: token::token,
|
|||
let initial_attrs = first_item_attrs;
|
||||
while p.token != term {
|
||||
let attrs = initial_attrs + parse_outer_attributes(p);
|
||||
initial_attrs = [];
|
||||
#debug["parse_mod_items: parse_item(attrs=%?)", attrs];
|
||||
alt parse_item(p, attrs) {
|
||||
some(i) { items += [i]; }
|
||||
|
@ -2078,7 +2077,14 @@ fn parse_mod_items(p: parser, term: token::token,
|
|||
}
|
||||
}
|
||||
#debug["parse_mod_items: attrs=%?", attrs];
|
||||
initial_attrs = [];
|
||||
}
|
||||
|
||||
if vec::is_not_empty(initial_attrs) {
|
||||
// We parsed attributes for the first item but didn't find the item
|
||||
p.fatal("expected item");
|
||||
}
|
||||
|
||||
ret {view_items: view_items, items: items};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue