Skip to content

Commit 4b8fba5

Browse files
committed
rustc: Fix regressed handling of bad attributes
Issue #487
1 parent ffa7c76 commit 4b8fba5

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/comp/front/parser.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1806,7 +1806,12 @@ fn parse_item_obj(&parser p, ast::layer lyr, vec[ast::attribute] attrs) ->
18061806

18071807
fn parse_mod_items(&parser p, token::token term,
18081808
vec[ast::attribute] first_item_attrs) -> ast::_mod {
1809-
auto view_items = parse_view(p);
1809+
auto view_items = if (vec::len(first_item_attrs) == 0u) {
1810+
parse_view(p)
1811+
} else {
1812+
// Shouldn't be any view items since we've already parsed an item attr
1813+
[]
1814+
};
18101815
let vec[@ast::item] items = [];
18111816
auto initial_attrs = first_item_attrs;
18121817
while (p.peek() != term) {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// xfail-stage0
2+
// error-pattern:expected item
3+
4+
mod m {
5+
#[foo = "bar"]
6+
use std;
7+
}
8+
9+
fn main() {
10+
}

0 commit comments

Comments
 (0)