Skip to content

Commit a9fe5ae

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 169314 b: refs/heads/master c: 07a8e7c h: refs/heads/master v: v3
1 parent 1074fff commit a9fe5ae

File tree

14 files changed

+30
-34
lines changed

14 files changed

+30
-34
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 37f62ae1c0ee44cb6ca563c18da19b8d5be58c0e
2+
refs/heads/master: 07a8e7cfb5128a2b1697713a0ec84329e4e44f1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 5b3cd3900ceda838f5798c30ab96ceb41f962534
55
refs/heads/try: 5204084bd2e46af7cc6e0147430e44dd0d657bbb

trunk/src/libsyntax/ext/deriving/clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub fn expand_deriving_clone<F>(cx: &mut ExtCtxt,
4040
args: Vec::new(),
4141
ret_ty: Self,
4242
attributes: attrs,
43-
combine_substructure: combine_substructure(|c, s, sub| {
43+
combine_substructure: combine_substructure(box |c, s, sub| {
4444
cs_clone("Clone", c, s, sub)
4545
}),
4646
}

trunk/src/libsyntax/ext/deriving/cmp/eq.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub fn expand_deriving_eq<F>(cx: &mut ExtCtxt,
4040
cx.expr_binary(span, ast::BiAnd, subexpr, eq)
4141
},
4242
cx.expr_bool(span, true),
43-
|cx, span, _, _| cx.expr_bool(span, false),
43+
box |cx, span, _, _| cx.expr_bool(span, false),
4444
cx, span, substr)
4545
}
4646
fn cs_ne(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> P<Expr> {
@@ -57,7 +57,7 @@ pub fn expand_deriving_eq<F>(cx: &mut ExtCtxt,
5757
cx.expr_binary(span, ast::BiOr, subexpr, eq)
5858
},
5959
cx.expr_bool(span, false),
60-
|cx, span, _, _| cx.expr_bool(span, true),
60+
box |cx, span, _, _| cx.expr_bool(span, true),
6161
cx, span, substr)
6262
}
6363

@@ -72,7 +72,7 @@ pub fn expand_deriving_eq<F>(cx: &mut ExtCtxt,
7272
args: vec!(borrowed_self()),
7373
ret_ty: Literal(Path::new(vec!("bool"))),
7474
attributes: attrs,
75-
combine_substructure: combine_substructure(|a, b, c| {
75+
combine_substructure: combine_substructure(box |a, b, c| {
7676
$f(a, b, c)
7777
})
7878
}

trunk/src/libsyntax/ext/deriving/cmp/ord.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub fn expand_deriving_ord<F>(cx: &mut ExtCtxt,
3838
args: vec!(borrowed_self()),
3939
ret_ty: Literal(Path::new(vec!("bool"))),
4040
attributes: attrs,
41-
combine_substructure: combine_substructure(|cx, span, substr| {
41+
combine_substructure: combine_substructure(box |cx, span, substr| {
4242
cs_op($op, $equal, cx, span, substr)
4343
})
4444
}
@@ -61,7 +61,7 @@ pub fn expand_deriving_ord<F>(cx: &mut ExtCtxt,
6161
args: vec![borrowed_self()],
6262
ret_ty: ret_ty,
6363
attributes: attrs,
64-
combine_substructure: combine_substructure(|cx, span, substr| {
64+
combine_substructure: combine_substructure(box |cx, span, substr| {
6565
cs_partial_cmp(cx, span, substr)
6666
})
6767
};
@@ -174,7 +174,7 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span,
174174
cx.expr_block(cx.block(span, vec!(assign), Some(if_)))
175175
},
176176
equals_expr.clone(),
177-
|cx, span, (self_args, tag_tuple), _non_self_args| {
177+
box |cx, span, (self_args, tag_tuple), _non_self_args| {
178178
if self_args.len() != 2 {
179179
cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`")
180180
} else {
@@ -222,7 +222,7 @@ fn cs_op(less: bool, equal: bool, cx: &mut ExtCtxt,
222222
cx.expr_binary(span, ast::BiOr, cmp, and)
223223
},
224224
cx.expr_bool(span, equal),
225-
|cx, span, (self_args, tag_tuple), _non_self_args| {
225+
box |cx, span, (self_args, tag_tuple), _non_self_args| {
226226
if self_args.len() != 2 {
227227
cx.span_bug(span, "not exactly 2 arguments in `deriving(PartialOrd)`")
228228
} else {

trunk/src/libsyntax/ext/deriving/cmp/totaleq.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub fn expand_deriving_totaleq<F>(cx: &mut ExtCtxt,
3232
let block = cx.block(span, stmts, None);
3333
cx.expr_block(block)
3434
},
35-
|cx, sp, _, _| cx.span_bug(sp, "non matching enums in deriving(Eq)?"),
35+
box |cx, sp, _, _| cx.span_bug(sp, "non matching enums in deriving(Eq)?"),
3636
cx,
3737
span,
3838
substr)
@@ -57,7 +57,7 @@ pub fn expand_deriving_totaleq<F>(cx: &mut ExtCtxt,
5757
args: vec!(),
5858
ret_ty: nil_ty(),
5959
attributes: attrs,
60-
combine_substructure: combine_substructure(|a, b, c| {
60+
combine_substructure: combine_substructure(box |a, b, c| {
6161
cs_total_eq_assert(a, b, c)
6262
})
6363
}

trunk/src/libsyntax/ext/deriving/cmp/totalord.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub fn expand_deriving_totalord<F>(cx: &mut ExtCtxt,
4141
args: vec!(borrowed_self()),
4242
ret_ty: Literal(Path::new(vec!("std", "cmp", "Ordering"))),
4343
attributes: attrs,
44-
combine_substructure: combine_substructure(|a, b, c| {
44+
combine_substructure: combine_substructure(box |a, b, c| {
4545
cs_cmp(a, b, c)
4646
}),
4747
}
@@ -130,7 +130,7 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span,
130130
cx.expr_block(cx.block(span, vec!(assign), Some(if_)))
131131
},
132132
cx.expr_path(equals_path.clone()),
133-
|cx, span, (self_args, tag_tuple), _non_self_args| {
133+
box |cx, span, (self_args, tag_tuple), _non_self_args| {
134134
if self_args.len() != 2 {
135135
cx.span_bug(span, "not exactly 2 arguments in `deriving(Ord)`")
136136
} else {

trunk/src/libsyntax/ext/deriving/decodable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ fn expand_deriving_decodable_imp<F>(cx: &mut ExtCtxt,
7676
true
7777
)),
7878
attributes: Vec::new(),
79-
combine_substructure: combine_substructure(|a, b, c| {
79+
combine_substructure: combine_substructure(box |a, b, c| {
8080
decodable_substructure(a, b, c, krate)
8181
}),
8282
})

trunk/src/libsyntax/ext/deriving/default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub fn expand_deriving_default<F>(cx: &mut ExtCtxt,
4040
args: Vec::new(),
4141
ret_ty: Self,
4242
attributes: attrs,
43-
combine_substructure: combine_substructure(|a, b, c| {
43+
combine_substructure: combine_substructure(box |a, b, c| {
4444
default_substructure(a, b, c)
4545
})
4646
})

trunk/src/libsyntax/ext/deriving/encodable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ fn expand_deriving_encodable_imp<F>(cx: &mut ExtCtxt,
152152
true
153153
)),
154154
attributes: Vec::new(),
155-
combine_substructure: combine_substructure(|a, b, c| {
155+
combine_substructure: combine_substructure(box |a, b, c| {
156156
encodable_substructure(a, b, c)
157157
}),
158158
})

trunk/src/libsyntax/ext/deriving/generic/mod.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -312,19 +312,15 @@ pub enum SubstructureFields<'a> {
312312
/// Combine the values of all the fields together. The last argument is
313313
/// all the fields of all the structures.
314314
pub type CombineSubstructureFunc<'a> =
315-
|&mut ExtCtxt, Span, &Substructure|: 'a -> P<Expr>;
315+
Box<FnMut(&mut ExtCtxt, Span, &Substructure) -> P<Expr> + 'a>;
316316

317317
/// Deal with non-matching enum variants. The tuple is a list of
318318
/// identifiers (one for each `Self` argument, which could be any of the
319319
/// variants since they have been collapsed together) and the identifiers
320320
/// holding the variant index value for each of the `Self` arguments. The
321321
/// last argument is all the non-`Self` args of the method being derived.
322322
pub type EnumNonMatchCollapsedFunc<'a> =
323-
|&mut ExtCtxt,
324-
Span,
325-
(&[Ident], &[Ident]),
326-
&[P<Expr>]|: 'a
327-
-> P<Expr>;
323+
Box<FnMut(&mut ExtCtxt, Span, (&[Ident], &[Ident]), &[P<Expr>]) -> P<Expr> + 'a>;
328324

329325
pub fn combine_substructure<'a>(f: CombineSubstructureFunc<'a>)
330326
-> RefCell<CombineSubstructureFunc<'a>> {
@@ -606,7 +602,7 @@ impl<'a> MethodDef<'a> {
606602
};
607603
let mut f = self.combine_substructure.borrow_mut();
608604
let f: &mut CombineSubstructureFunc = &mut *f;
609-
(*f)(cx, trait_.span, &substructure)
605+
f.call_mut((cx, trait_.span, &substructure))
610606
}
611607

612608
fn get_ret_ty(&self,
@@ -1341,7 +1337,7 @@ impl<'a> TraitDef<'a> {
13411337
pub fn cs_fold<F>(use_foldl: bool,
13421338
mut f: F,
13431339
base: P<Expr>,
1344-
enum_nonmatch_f: EnumNonMatchCollapsedFunc,
1340+
mut enum_nonmatch_f: EnumNonMatchCollapsedFunc,
13451341
cx: &mut ExtCtxt,
13461342
trait_span: Span,
13471343
substructure: &Substructure)
@@ -1369,8 +1365,8 @@ pub fn cs_fold<F>(use_foldl: bool,
13691365
}
13701366
},
13711367
EnumNonMatchingCollapsed(ref all_args, _, tuple) =>
1372-
enum_nonmatch_f(cx, trait_span, (all_args[], tuple),
1373-
substructure.nonself_args),
1368+
enum_nonmatch_f.call_mut((cx, trait_span, (all_args[], tuple),
1369+
substructure.nonself_args)),
13741370
StaticEnum(..) | StaticStruct(..) => {
13751371
cx.span_bug(trait_span, "static function in `derive`")
13761372
}
@@ -1387,7 +1383,7 @@ pub fn cs_fold<F>(use_foldl: bool,
13871383
/// ```
13881384
#[inline]
13891385
pub fn cs_same_method<F>(f: F,
1390-
enum_nonmatch_f: EnumNonMatchCollapsedFunc,
1386+
mut enum_nonmatch_f: EnumNonMatchCollapsedFunc,
13911387
cx: &mut ExtCtxt,
13921388
trait_span: Span,
13931389
substructure: &Substructure)
@@ -1409,8 +1405,8 @@ pub fn cs_same_method<F>(f: F,
14091405
f(cx, trait_span, called)
14101406
},
14111407
EnumNonMatchingCollapsed(ref all_self_args, _, tuple) =>
1412-
enum_nonmatch_f(cx, trait_span, (all_self_args[], tuple),
1413-
substructure.nonself_args),
1408+
enum_nonmatch_f.call_mut((cx, trait_span, (all_self_args[], tuple),
1409+
substructure.nonself_args)),
14141410
StaticEnum(..) | StaticStruct(..) => {
14151411
cx.span_bug(trait_span, "static function in `derive`")
14161412
}

trunk/src/libsyntax/ext/deriving/hash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub fn expand_deriving_hash<F>(cx: &mut ExtCtxt,
5555
args: vec!(Ptr(box Literal(args), Borrowed(None, MutMutable))),
5656
ret_ty: nil_ty(),
5757
attributes: attrs,
58-
combine_substructure: combine_substructure(|a, b, c| {
58+
combine_substructure: combine_substructure(box |a, b, c| {
5959
hash_substructure(a, b, c)
6060
})
6161
}

trunk/src/libsyntax/ext/deriving/primitive.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub fn expand_deriving_from_primitive<F>(cx: &mut ExtCtxt,
4646
true)),
4747
// #[inline] liable to cause code-bloat
4848
attributes: attrs.clone(),
49-
combine_substructure: combine_substructure(|c, s, sub| {
49+
combine_substructure: combine_substructure(box |c, s, sub| {
5050
cs_from("i64", c, s, sub)
5151
}),
5252
},
@@ -62,7 +62,7 @@ pub fn expand_deriving_from_primitive<F>(cx: &mut ExtCtxt,
6262
true)),
6363
// #[inline] liable to cause code-bloat
6464
attributes: attrs,
65-
combine_substructure: combine_substructure(|c, s, sub| {
65+
combine_substructure: combine_substructure(box |c, s, sub| {
6666
cs_from("u64", c, s, sub)
6767
}),
6868
})

trunk/src/libsyntax/ext/deriving/rand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub fn expand_deriving_rand<F>(cx: &mut ExtCtxt,
4545
),
4646
ret_ty: Self,
4747
attributes: Vec::new(),
48-
combine_substructure: combine_substructure(|a, b, c| {
48+
combine_substructure: combine_substructure(box |a, b, c| {
4949
rand_substructure(a, b, c)
5050
})
5151
}

trunk/src/libsyntax/ext/deriving/show.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub fn expand_deriving_show<F>(cx: &mut ExtCtxt,
4646
args: vec!(fmtr),
4747
ret_ty: Literal(Path::new(vec!("std", "fmt", "Result"))),
4848
attributes: Vec::new(),
49-
combine_substructure: combine_substructure(|a, b, c| {
49+
combine_substructure: combine_substructure(box |a, b, c| {
5050
show_substructure(a, b, c)
5151
})
5252
}

0 commit comments

Comments
 (0)