about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-05-02 16:39:08 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-05-03 02:09:30 -0700
commit71a52a2edc76527e3bba92378da633bb1fde3743 (patch)
treecc43e2fe70d1f70c617f13490fe4faf3ca13edbb /src/libsyntax/parse/parser.rs
parent0b7954fa809690037bcb80f44d3383329bce48ad (diff)
downloadrust-71a52a2edc76527e3bba92378da633bb1fde3743.tar.gz
rust-71a52a2edc76527e3bba92378da633bb1fde3743.zip
syntax: Fix duplicate attributes on module files
The outer attributes were manually appended when a module file was parsed, but
the attributes were also added higher up the stack of parsing (when the module
finished parsing). This removes the append in parsing the module file.

Closes #13826
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 5d8443b64d5..2173a15b5f1 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -4155,14 +4155,11 @@ impl<'a> Parser<'a> {
             }
         };
 
-        self.eval_src_mod_from_path(file_path,
-                                    outer_attrs.iter().map(|x| *x).collect(),
-                                    id_sp)
+        self.eval_src_mod_from_path(file_path, id_sp)
     }
 
     fn eval_src_mod_from_path(&mut self,
                               path: Path,
-                              outer_attrs: Vec<ast::Attribute> ,
                               id_sp: Span) -> (ast::Item_, Vec<ast::Attribute> ) {
         let mut included_mod_stack = self.sess.included_mod_stack.borrow_mut();
         match included_mod_stack.iter().position(|p| *p == path) {
@@ -4187,8 +4184,7 @@ impl<'a> Parser<'a> {
                                      &path,
                                      id_sp);
         let mod_inner_lo = p0.span.lo;
-        let (inner, next) = p0.parse_inner_attrs_and_next();
-        let mod_attrs = outer_attrs.append(inner.as_slice());
+        let (mod_attrs, next) = p0.parse_inner_attrs_and_next();
         let first_item_outer_attrs = next;
         let m0 = p0.parse_mod_items(token::EOF, first_item_outer_attrs, mod_inner_lo);
         self.sess.included_mod_stack.borrow_mut().pop();