Add better error messages for bad attributes in .rc files

Issue #487
This commit is contained in:
Brian Anderson 2011-06-16 17:18:35 -07:00
parent fc12577fdd
commit 6f4326c54d
2 changed files with 7 additions and 1 deletions

View File

@ -2125,7 +2125,8 @@ fn parse_inner_attrs_and_next(&parser p) -> tup(vec[ast::attribute],
fn parse_inner_attrs(&parser p) -> vec[ast::attribute] {
auto attrs_and_next = parse_inner_attrs_and_next(p);
if (vec::len(attrs_and_next._1) > 0u) {
// FIXME: Don't drop this dangling attr on the ground
ret p.err("expected crate directive but found " +
token::to_str(p.get_reader(), p.peek()));
}
ret attrs_and_next._0;
}

View File

@ -0,0 +1,5 @@
// xfail-stage0
// error-pattern: expected crate directive
#[attr = "val"];
#[attr = "val"] // Unterminated