about summary refs log tree commit diff
path: root/src/comp/syntax/parse
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-02-22 21:47:23 -0800
committerBrian Anderson <banderson@mozilla.com>2012-02-22 21:47:23 -0800
commit27ab663845e66d908ec4e4549d333e95561dbe26 (patch)
tree18687d24a75bb04ca3a2a4770d148391411bf005 /src/comp/syntax/parse
parentffa77dd610bc15871d32b93228e680f94d30a5c6 (diff)
rustc: Don't ignore attributes inside empty mods. Closes #1655
Diffstat (limited to 'src/comp/syntax/parse')
-rw-r--r--src/comp/syntax/parse/parser.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index 7cdb5667665..1a8fbdd917a 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -2068,7 +2068,6 @@ fn parse_mod_items(p: parser, term: token::token,
     let initial_attrs = first_item_attrs;
     while p.token != term {
         let attrs = initial_attrs + parse_outer_attributes(p);
-        initial_attrs = [];
         #debug["parse_mod_items: parse_item(attrs=%?)", attrs];
         alt parse_item(p, attrs) {
           some(i) { items += [i]; }
@@ -2078,7 +2077,14 @@ fn parse_mod_items(p: parser, term: token::token,
           }
         }
         #debug["parse_mod_items: attrs=%?", attrs];
+        initial_attrs = [];
+    }
+
+    if vec::is_not_empty(initial_attrs) {
+        // We parsed attributes for the first item but didn't find the item
+        p.fatal("expected item");
     }
+
     ret {view_items: view_items, items: items};
 }