From 71a52a2edc76527e3bba92378da633bb1fde3743 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 2 May 2014 16:39:08 -0700 Subject: 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 --- src/libsyntax/parse/parser.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/libsyntax/parse/parser.rs') 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 , id_sp: Span) -> (ast::Item_, Vec ) { 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(); -- cgit 1.4.1-3-g733a5