Skip to content

Commit 9a2942b

Browse files
committed
---
yaml --- r: 217019 b: refs/heads/stable c: c0a42ae h: refs/heads/master i: 217017: e62ad16 217015: dd37a5a v: v3
1 parent 964fffb commit 9a2942b

File tree

17 files changed

+300
-278
lines changed

17 files changed

+300
-278
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ refs/heads/tmp: 378a370ff2057afeb1eae86eb6e78c476866a4a6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: a5286998df566e736b32f6795bfc3803bdaf453d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 0a4f9a26962d85d57a0b603ad324bd86fdd474cf
32+
refs/heads/stable: c0a42aecbc85298fb6351253c4cd1824567b7a42
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375

branches/stable/src/libsyntax/ext/base.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,16 @@ impl Annotatable {
123123
}
124124
}
125125

126+
pub fn map_item_or<F, G>(self, mut f: F, mut or: G) -> Annotatable
127+
where F: FnMut(P<ast::Item>) -> P<ast::Item>,
128+
G: FnMut(Annotatable) -> Annotatable
129+
{
130+
match self {
131+
Annotatable::Item(i) => Annotatable::Item(f(i)),
132+
_ => or(self)
133+
}
134+
}
135+
126136
pub fn expect_trait_item(self) -> P<ast::TraitItem> {
127137
match self {
128138
Annotatable::TraitItem(i) => i,
@@ -144,18 +154,18 @@ pub trait MultiItemDecorator {
144154
ecx: &mut ExtCtxt,
145155
sp: Span,
146156
meta_item: &ast::MetaItem,
147-
item: &Annotatable,
148-
push: &mut FnMut(Annotatable));
157+
item: Annotatable,
158+
push: &mut FnMut(Annotatable));
149159
}
150160

151161
impl<F> MultiItemDecorator for F
152-
where F : Fn(&mut ExtCtxt, Span, &ast::MetaItem, &Annotatable, &mut FnMut(Annotatable))
162+
where F : Fn(&mut ExtCtxt, Span, &ast::MetaItem, Annotatable, &mut FnMut(Annotatable))
153163
{
154164
fn expand(&self,
155165
ecx: &mut ExtCtxt,
156166
sp: Span,
157167
meta_item: &ast::MetaItem,
158-
item: &Annotatable,
168+
item: Annotatable,
159169
push: &mut FnMut(Annotatable)) {
160170
(*self)(ecx, sp, meta_item, item, push)
161171
}
@@ -433,6 +443,7 @@ pub enum SyntaxExtension {
433443
/// based upon it.
434444
#[unstable(feature = "rustc_private")]
435445
#[deprecated(since = "1.0.0", reason = "replaced by MultiDecorator")]
446+
#[allow(deprecated)]
436447
Decorator(Box<ItemDecorator + 'static>),
437448

438449
/// A syntax extension that is attached to an item and creates new items
@@ -445,6 +456,7 @@ pub enum SyntaxExtension {
445456
/// in-place.
446457
#[unstable(feature = "rustc_private")]
447458
#[deprecated(since = "1.0.0", reason = "replaced by MultiModifier")]
459+
#[allow(deprecated)]
448460
Modifier(Box<ItemModifier + 'static>),
449461

450462
/// A syntax extension that is attached to an item and modifies it

branches/stable/src/libsyntax/ext/deriving/bounds.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,26 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use ast::{MetaItem, Item};
11+
use ast::MetaItem;
1212
use codemap::Span;
13-
use ext::base::ExtCtxt;
13+
use ext::base::{ExtCtxt, Annotatable};
1414
use ext::deriving::generic::*;
1515
use ext::deriving::generic::ty::*;
16-
use ptr::P;
1716

1817
pub fn expand_deriving_unsafe_bound(cx: &mut ExtCtxt,
1918
span: Span,
2019
_: &MetaItem,
21-
_: &Item,
22-
_: &mut FnMut(P<Item>))
20+
_: Annotatable,
21+
_: &mut FnMut(Annotatable))
2322
{
2423
cx.span_err(span, "this unsafe trait should be implemented explicitly");
2524
}
2625

2726
pub fn expand_deriving_copy(cx: &mut ExtCtxt,
2827
span: Span,
2928
mitem: &MetaItem,
30-
item: &Item,
31-
push: &mut FnMut(P<Item>))
29+
item: Annotatable,
30+
push: &mut FnMut(Annotatable))
3231
{
3332
let path = Path::new(vec![
3433
if cx.use_std { "std" } else { "core" },

branches/stable/src/libsyntax/ext/deriving/clone.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use ast::{MetaItem, Item, Expr};
11+
use ast::{MetaItem, Expr};
1212
use codemap::Span;
13-
use ext::base::ExtCtxt;
13+
use ext::base::{ExtCtxt, Annotatable};
1414
use ext::build::AstBuilder;
1515
use ext::deriving::generic::*;
1616
use ext::deriving::generic::ty::*;
@@ -20,8 +20,8 @@ use ptr::P;
2020
pub fn expand_deriving_clone(cx: &mut ExtCtxt,
2121
span: Span,
2222
mitem: &MetaItem,
23-
item: &Item,
24-
push: &mut FnMut(P<Item>))
23+
item: Annotatable,
24+
push: &mut FnMut(Annotatable))
2525
{
2626
let inline = cx.meta_word(span, InternedString::new("inline"));
2727
let attrs = vec!(cx.attribute(span, inline));

branches/stable/src/libsyntax/ext/deriving/cmp/eq.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use ast::{MetaItem, Item, Expr};
11+
use ast::{MetaItem, Expr};
1212
use codemap::Span;
13-
use ext::base::ExtCtxt;
13+
use ext::base::{ExtCtxt, Annotatable};
1414
use ext::build::AstBuilder;
1515
use ext::deriving::generic::*;
1616
use ext::deriving::generic::ty::*;
@@ -20,8 +20,8 @@ use ptr::P;
2020
pub fn expand_deriving_eq(cx: &mut ExtCtxt,
2121
span: Span,
2222
mitem: &MetaItem,
23-
item: &Item,
24-
push: &mut FnMut(P<Item>))
23+
item: Annotatable,
24+
push: &mut FnMut(Annotatable))
2525
{
2626
fn cs_total_eq_assert(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> P<Expr> {
2727
cs_same_method(

branches/stable/src/libsyntax/ext/deriving/cmp/ord.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
// except according to those terms.
1010

1111
use ast;
12-
use ast::{MetaItem, Item, Expr};
12+
use ast::{MetaItem, Expr};
1313
use codemap::Span;
14-
use ext::base::ExtCtxt;
14+
use ext::base::{ExtCtxt, Annotatable};
1515
use ext::build::AstBuilder;
1616
use ext::deriving::generic::*;
1717
use ext::deriving::generic::ty::*;
@@ -21,8 +21,8 @@ use ptr::P;
2121
pub fn expand_deriving_ord(cx: &mut ExtCtxt,
2222
span: Span,
2323
mitem: &MetaItem,
24-
item: &Item,
25-
push: &mut FnMut(P<Item>))
24+
item: Annotatable,
25+
push: &mut FnMut(Annotatable))
2626
{
2727
let inline = cx.meta_word(span, InternedString::new("inline"));
2828
let attrs = vec!(cx.attribute(span, inline));

branches/stable/src/libsyntax/ext/deriving/cmp/partial_eq.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use ast::{MetaItem, Item, Expr, self};
11+
use ast::{MetaItem, Expr, self};
1212
use codemap::Span;
13-
use ext::base::ExtCtxt;
13+
use ext::base::{ExtCtxt, Annotatable};
1414
use ext::build::AstBuilder;
1515
use ext::deriving::generic::*;
1616
use ext::deriving::generic::ty::*;
@@ -20,8 +20,8 @@ use ptr::P;
2020
pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt,
2121
span: Span,
2222
mitem: &MetaItem,
23-
item: &Item,
24-
push: &mut FnMut(P<Item>))
23+
item: Annotatable,
24+
push: &mut FnMut(Annotatable))
2525
{
2626
// structures are equal if all fields are equal, and non equal, if
2727
// any fields are not equal or if the enum variants are different

branches/stable/src/libsyntax/ext/deriving/cmp/partial_ord.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
pub use self::OrderingOp::*;
1212

1313
use ast;
14-
use ast::{MetaItem, Item, Expr};
14+
use ast::{MetaItem, Expr};
1515
use codemap::Span;
16-
use ext::base::ExtCtxt;
16+
use ext::base::{ExtCtxt, Annotatable};
1717
use ext::build::AstBuilder;
1818
use ext::deriving::generic::*;
1919
use ext::deriving::generic::ty::*;
@@ -23,8 +23,8 @@ use ptr::P;
2323
pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt,
2424
span: Span,
2525
mitem: &MetaItem,
26-
item: &Item,
27-
push: &mut FnMut(P<Item>))
26+
item: Annotatable,
27+
push: &mut FnMut(Annotatable))
2828
{
2929
macro_rules! md {
3030
($name:expr, $op:expr, $equal:expr) => { {

branches/stable/src/libsyntax/ext/deriving/decodable.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
//! The compiler code necessary for `#[derive(Decodable)]`. See encodable.rs for more.
1212
1313
use ast;
14-
use ast::{MetaItem, Item, Expr, MutMutable};
14+
use ast::{MetaItem, Expr, MutMutable};
1515
use codemap::Span;
16-
use ext::base::ExtCtxt;
16+
use ext::base::{ExtCtxt, Annotatable};
1717
use ext::build::AstBuilder;
1818
use ext::deriving::generic::*;
1919
use ext::deriving::generic::ty::*;
@@ -24,26 +24,26 @@ use ptr::P;
2424
pub fn expand_deriving_rustc_decodable(cx: &mut ExtCtxt,
2525
span: Span,
2626
mitem: &MetaItem,
27-
item: &Item,
28-
push: &mut FnMut(P<Item>))
27+
item: Annotatable,
28+
push: &mut FnMut(Annotatable))
2929
{
3030
expand_deriving_decodable_imp(cx, span, mitem, item, push, "rustc_serialize")
3131
}
3232

3333
pub fn expand_deriving_decodable(cx: &mut ExtCtxt,
3434
span: Span,
3535
mitem: &MetaItem,
36-
item: &Item,
37-
push: &mut FnMut(P<Item>))
36+
item: Annotatable,
37+
push: &mut FnMut(Annotatable))
3838
{
3939
expand_deriving_decodable_imp(cx, span, mitem, item, push, "serialize")
4040
}
4141

4242
fn expand_deriving_decodable_imp(cx: &mut ExtCtxt,
4343
span: Span,
4444
mitem: &MetaItem,
45-
item: &Item,
46-
push: &mut FnMut(P<Item>),
45+
item: Annotatable,
46+
push: &mut FnMut(Annotatable),
4747
krate: &'static str)
4848
{
4949
if !cx.use_std {

branches/stable/src/libsyntax/ext/deriving/default.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use ast::{MetaItem, Item, Expr};
11+
use ast::{MetaItem, Expr};
1212
use codemap::Span;
13-
use ext::base::ExtCtxt;
13+
use ext::base::{ExtCtxt, Annotatable};
1414
use ext::build::AstBuilder;
1515
use ext::deriving::generic::*;
1616
use ext::deriving::generic::ty::*;
@@ -20,8 +20,8 @@ use ptr::P;
2020
pub fn expand_deriving_default(cx: &mut ExtCtxt,
2121
span: Span,
2222
mitem: &MetaItem,
23-
item: &Item,
24-
push: &mut FnMut(P<Item>))
23+
item: Annotatable,
24+
push: &mut FnMut(Annotatable))
2525
{
2626
let inline = cx.meta_word(span, InternedString::new("inline"));
2727
let attrs = vec!(cx.attribute(span, inline));

branches/stable/src/libsyntax/ext/deriving/encodable.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@
8888
//! }
8989
//! ```
9090
91-
use ast::{MetaItem, Item, Expr, ExprRet, MutMutable};
91+
use ast::{MetaItem, Expr, ExprRet, MutMutable};
9292
use codemap::Span;
93-
use ext::base::ExtCtxt;
93+
use ext::base::{ExtCtxt,Annotatable};
9494
use ext::build::AstBuilder;
9595
use ext::deriving::generic::*;
9696
use ext::deriving::generic::ty::*;
@@ -100,26 +100,26 @@ use ptr::P;
100100
pub fn expand_deriving_rustc_encodable(cx: &mut ExtCtxt,
101101
span: Span,
102102
mitem: &MetaItem,
103-
item: &Item,
104-
push: &mut FnMut(P<Item>))
103+
item: Annotatable,
104+
push: &mut FnMut(Annotatable))
105105
{
106106
expand_deriving_encodable_imp(cx, span, mitem, item, push, "rustc_serialize")
107107
}
108108

109109
pub fn expand_deriving_encodable(cx: &mut ExtCtxt,
110110
span: Span,
111111
mitem: &MetaItem,
112-
item: &Item,
113-
push: &mut FnMut(P<Item>))
112+
item: Annotatable,
113+
push: &mut FnMut(Annotatable))
114114
{
115115
expand_deriving_encodable_imp(cx, span, mitem, item, push, "serialize")
116116
}
117117

118118
fn expand_deriving_encodable_imp(cx: &mut ExtCtxt,
119119
span: Span,
120120
mitem: &MetaItem,
121-
item: &Item,
122-
push: &mut FnMut(P<Item>),
121+
item: Annotatable,
122+
push: &mut FnMut(Annotatable),
123123
krate: &'static str)
124124
{
125125
if !cx.use_std {

0 commit comments

Comments
 (0)