diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-06-16 16:09:43 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-06-16 17:23:20 -0700 |
| commit | e83a115d7987aead4d4ea33b0ca4dda6cd9aa0f0 (patch) | |
| tree | 191ccb5df83a2a0f04f808930c463359f8a7f90a /src | |
| parent | ffae6426630f719b6f1168c359f0f1a8b405bbc6 (diff) | |
| download | rust-e83a115d7987aead4d4ea33b0ca4dda6cd9aa0f0.tar.gz rust-e83a115d7987aead4d4ea33b0ca4dda6cd9aa0f0.zip | |
rustc: Parse crate attributes in standalone .rs files
Issue #487
Diffstat (limited to 'src')
| -rw-r--r-- | src/comp/front/parser.rs | 6 | ||||
| -rw-r--r-- | src/test/run-pass/item-attributes.rs | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index f1121c814aa..33ddcc6d57d 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -2285,7 +2285,11 @@ fn parse_native_view(&parser p) -> vec[@ast::view_item] { fn parse_crate_from_source_file(&parser p) -> @ast::crate { auto lo = p.get_lo_pos(); - auto m = parse_mod_items(p, token::EOF, []); + // FIXME (issue #487): Do something with these attrs + auto crate_attrs = parse_inner_attrs_and_next(p); + auto first_item_outer_attrs = crate_attrs._1; + auto m = parse_mod_items(p, token::EOF, + first_item_outer_attrs); let vec[@ast::crate_directive] cdirs = []; ret @spanned(lo, p.get_lo_pos(), rec(directives=cdirs, module=m)); } diff --git a/src/test/run-pass/item-attributes.rs b/src/test/run-pass/item-attributes.rs index f9a8c613486..667e537ca37 100644 --- a/src/test/run-pass/item-attributes.rs +++ b/src/test/run-pass/item-attributes.rs @@ -1,5 +1,11 @@ // xfail-stage0 +// These are attributes of the implicit crate. Really this just needs to parse +// for completeness since .rs files linked from .rc files support this +// notation to specify their module's attributes +#[attr1 = "val"]; +#[attr2 = "val"]; + // These are are attributes of the following mod #[attr1 = "val"] #[attr2 = "val"] |
