Skip to content

Commit 96f9d9d

Browse files
paulstansifergraydon
authored andcommitted
---
yaml --- r: 35297 b: refs/heads/master c: 15e03e1 h: refs/heads/master i: 35295: 6c6899a v: v3
1 parent c24d6bd commit 96f9d9d

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 6174a30d7c136c0fd163d512dfac840741a39f7c
2+
refs/heads/master: 15e03e1e5e7bbde88b15411f9cb529d02ff5d23e
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024

trunk/src/libsyntax/parse/parser.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2197,7 +2197,7 @@ impl Parser {
21972197
fn check_expected_item(p: Parser, current_attrs: ~[attribute]) {
21982198
// If we have attributes then we should have an item
21992199
if vec::is_not_empty(current_attrs) {
2200-
p.fatal(~"expected item");
2200+
p.fatal(~"expected item after attrs");
22012201
}
22022202
}
22032203
@@ -2210,6 +2210,9 @@ impl Parser {
22102210
} else if is_ident(self.token)
22112211
&& !self.is_any_keyword(copy self.token)
22122212
&& self.look_ahead(1) == token::NOT {
2213+
2214+
check_expected_item(self, first_item_attrs);
2215+
22132216
// Potential trouble: if we allow macros with paths instead of
22142217
// idents, we'd need to look ahead past the whole path here...
22152218
let pth = self.parse_value_path();
@@ -2381,7 +2384,7 @@ impl Parser {
23812384
}
23822385
}
23832386

2384-
stmt_mac(m, false) => {
2387+
stmt_mac(m, _) => {
23852388
// Statement macro; might be an expr
23862389
match self.token {
23872390
token::SEMI => {
@@ -3590,6 +3593,10 @@ impl Parser {
35903593
&& (is_plain_ident(self.look_ahead(2))
35913594
|| self.look_ahead(2) == token::LPAREN
35923595
|| self.look_ahead(2) == token::LBRACE) {
3596+
if attrs.len() > 0 {
3597+
self.fatal(~"attrs on macros are not yet supported");
3598+
}
3599+
35933600
// item macro.
35943601
let pth = self.parse_path_without_tps();
35953602
self.expect(token::NOT);

trunk/src/libsyntax/parse/token.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ impl ident_interner {
344344
}
345345
}
346346

347-
/** Key for thread-local data for sneaking interner information to the
347+
/* Key for thread-local data for sneaking interner information to the
348348
* serializer/deserializer. It sounds like a hack because it is one.
349349
* Bonus ultra-hack: functions as keys don't work across crates,
350350
* so we have to use a unique number. See taskgroup_key! in task.rs
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
fn main() {
22
#[attr]
3-
debug!("hi"); //~ ERROR expected item
3+
debug!("hi"); //~ ERROR expected item after attrs
44
}

trunk/src/test/compile-fail/ext-after-attrib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// error-pattern:expected item but found `fmt`
1+
// error-pattern:attrs on macros are not yet supported
22

33
// Don't know how to deal with a syntax extension appearing after an
44
// item attribute. Probably could use a better error message.

0 commit comments

Comments
 (0)