Skip to content

Commit 352f2a4

Browse files
paulstansifergraydon
authored andcommitted
---
yaml --- r: 39155 b: refs/heads/incoming c: 15e03e1 h: refs/heads/master i: 39153: 219bec4 39151: 3581d1e v: v3
1 parent 933de73 commit 352f2a4

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
@@ -6,7 +6,7 @@ refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
9-
refs/heads/incoming: 6174a30d7c136c0fd163d512dfac840741a39f7c
9+
refs/heads/incoming: 15e03e1e5e7bbde88b15411f9cb529d02ff5d23e
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

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