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/ext | |
| 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/ext')
| -rw-r--r-- | src/libsyntax/ext/build.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/primitive.rs | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index e1174ea6cc4..b0dbd8b635a 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -726,6 +726,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { fn arm(&self, _span: Span, pats: Vec<@ast::Pat> , expr: @ast::Expr) -> ast::Arm { ast::Arm { + attrs: vec!(), pats: pats, guard: None, body: expr diff --git a/src/libsyntax/ext/deriving/primitive.rs b/src/libsyntax/ext/deriving/primitive.rs index 0a7aa591657..9978a2edce9 100644 --- a/src/libsyntax/ext/deriving/primitive.rs +++ b/src/libsyntax/ext/deriving/primitive.rs @@ -112,6 +112,7 @@ fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure // arm for `_ if $guard => $body` let arm = ast::Arm { + attrs: vec!(), pats: vec!(cx.pat_wild(span)), guard: Some(guard), body: body, @@ -131,6 +132,7 @@ fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure // arm for `_ => None` let arm = ast::Arm { + attrs: vec!(), pats: vec!(cx.pat_wild(trait_span)), guard: None, body: cx.expr_none(trait_span), |
