Skip to content

Commit c86c0b2

Browse files
paulstansifergraydon
authored andcommitted
---
yaml --- r: 37771 b: refs/heads/try c: 15e03e1 h: refs/heads/master i: 37769: 33d813e 37767: 0be5f7f v: v3
1 parent 6411ff6 commit c86c0b2

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
@@ -2,7 +2,7 @@
22
refs/heads/master: 09bb07bed9166105ea961a42b5fff7739ae0d2e9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
5-
refs/heads/try: 6174a30d7c136c0fd163d512dfac840741a39f7c
5+
refs/heads/try: 15e03e1e5e7bbde88b15411f9cb529d02ff5d23e
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/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);

branches/try/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
}

branches/try/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)