Skip to content

Commit 6f4326c

Browse files
committed
Add better error messages for bad attributes in .rc files
Issue #487
1 parent fc12577 commit 6f4326c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/comp/front/parser.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2125,7 +2125,8 @@ fn parse_inner_attrs_and_next(&parser p) -> tup(vec[ast::attribute],
21252125
fn parse_inner_attrs(&parser p) -> vec[ast::attribute] {
21262126
auto attrs_and_next = parse_inner_attrs_and_next(p);
21272127
if (vec::len(attrs_and_next._1) > 0u) {
2128-
// FIXME: Don't drop this dangling attr on the ground
2128+
ret p.err("expected crate directive but found " +
2129+
token::to_str(p.get_reader(), p.peek()));
21292130
}
21302131
ret attrs_and_next._0;
21312132
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// xfail-stage0
2+
// error-pattern: expected crate directive
3+
4+
#[attr = "val"];
5+
#[attr = "val"] // Unterminated

0 commit comments

Comments
 (0)