rustc: Fix a bug in cdir attribute parsing

The first attribute of the first mod was being applied to every mod.
This commit is contained in:
Brian Anderson 2011-11-24 16:17:26 -08:00
parent 3e303af86b
commit 7aee9f7b56
2 changed files with 13 additions and 0 deletions

View File

@ -2515,9 +2515,11 @@ fn parse_crate_directives(p: parser, term: token::token,
}
let cdirs: [@ast::crate_directive] = [];
let first_outer_attr = first_outer_attr;
while p.peek() != term {
let cdir = @parse_crate_directive(p, first_outer_attr);
cdirs += [cdir];
first_outer_attr = [];
}
ret cdirs;
}

View File

@ -0,0 +1,11 @@
// Regression test for a problem with the first mod attribute
// being applied to every mod
#[cfg(target_os = "linux")]
mod hello;
#[cfg(target_os = "macos")]
mod hello;
#[cfg(target_os = "win32")]
mod hello;