diff options
| author | bors <bors@rust-lang.org> | 2014-04-23 23:51:30 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-04-23 23:51:30 -0700 |
| commit | 867898977d30a79ef19d5588c1632f48e75cb98f (patch) | |
| tree | fadd42a856cb56ccc07a66920331eb19a5a4d331 /src/libsyntax/parse | |
| parent | 4e1a09844e49a91d0f9dea19561f15d34992d0e8 (diff) | |
| parent | 1452c9c04a11dd6ad6890b811b411ef80b0c5b6f (diff) | |
| download | rust-867898977d30a79ef19d5588c1632f48e75cb98f.tar.gz rust-867898977d30a79ef19d5588c1632f48e75cb98f.zip | |
auto merge of #12812 : sfackler/rust/attr-arm, r=alexcrichton
This is really only useful for #[cfg()]. For example:
```rust
enum Foo {
Bar,
Baz,
#[cfg(blob)]
Blob
}
fn match_foos(f: &Foo) {
match *f {
Bar => {}
Baz => {}
#[cfg(blob)]
Blob => {}
}
}
```
This is a kind of weird place to allow attributes, so it should probably
be discussed before merging.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 8808312bed7..f30d756d854 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2539,6 +2539,7 @@ impl<'a> Parser<'a> { self.commit_expr_expecting(discriminant, token::LBRACE); let mut arms: Vec<Arm> = Vec::new(); while self.token != token::RBRACE { + let attrs = self.parse_outer_attributes(); let pats = self.parse_pats(); let mut guard = None; if self.eat_keyword(keywords::If) { @@ -2557,7 +2558,12 @@ impl<'a> Parser<'a> { self.eat(&token::COMMA); } - arms.push(ast::Arm { pats: pats, guard: guard, body: expr }); + arms.push(ast::Arm { + attrs: attrs, + pats: pats, + guard: guard, + body: expr + }); } let hi = self.span.hi; self.bump(); |
