diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-11-24 16:17:26 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-11-24 16:18:26 -0800 |
| commit | 7aee9f7b56f8d96f9444ebb1d06e32e024b81974 (patch) | |
| tree | 66ce836ff65e1a3c8ecc3d7d8bd161ca14e24ac0 /src | |
| parent | 3e303af86b5380c7d53a8879d883cd36ad2a69a6 (diff) | |
| download | rust-7aee9f7b56f8d96f9444ebb1d06e32e024b81974.tar.gz rust-7aee9f7b56f8d96f9444ebb1d06e32e024b81974.zip | |
rustc: Fix a bug in cdir attribute parsing
The first attribute of the first mod was being applied to every mod.
Diffstat (limited to 'src')
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/dupe-first-attr.rc | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 82c477a7d96..a8f294820af 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -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; } diff --git a/src/test/run-pass/dupe-first-attr.rc b/src/test/run-pass/dupe-first-attr.rc new file mode 100644 index 00000000000..65798b048f9 --- /dev/null +++ b/src/test/run-pass/dupe-first-attr.rc @@ -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; \ No newline at end of file |
