1
Fork 0

rustc: Don't ignore attributes inside empty mods. Closes #1655

This commit is contained in:
Brian Anderson 2012-02-22 21:47:23 -08:00
parent ffa77dd610
commit 27ab663845
2 changed files with 18 additions and 1 deletions

View file

@ -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};
}

View file

@ -0,0 +1,11 @@
// error-pattern:expected item
mod blade_runner {
#[doc(
brief = "Blade Runner is probably the best movie ever",
desc = "I like that in the world of Blade Runner it is always
raining, and that it's always night time. And Aliens
was also a really good movie.
Alien 3 was crap though."
)]
}