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:
parent
3e303af86b
commit
7aee9f7b56
@ -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;
|
||||
}
|
||||
|
11
src/test/run-pass/dupe-first-attr.rc
Normal file
11
src/test/run-pass/dupe-first-attr.rc
Normal 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;
|
Loading…
Reference in New Issue
Block a user