Skip to content

Commit 537dc9f

Browse files
committed
---
yaml --- r: 148981 b: refs/heads/try2 c: fa191a5 h: refs/heads/master i: 148979: 6331e58 v: v3
1 parent b2f4d0b commit 537dc9f

File tree

17 files changed

+64
-64
lines changed

17 files changed

+64
-64
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: eac673ab0c27cb00a6bdc70103185b5090a467fe
8+
refs/heads/try2: fa191a559171094d89a598884ea18aba6cbda858
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub struct MacroDef {
3636
}
3737

3838
pub type ItemDecorator =
39-
fn(&ExtCtxt, Span, @ast::MetaItem, ~[@ast::Item]) -> ~[@ast::Item];
39+
fn(&mut ExtCtxt, Span, @ast::MetaItem, ~[@ast::Item]) -> ~[@ast::Item];
4040

4141
pub struct BasicMacroExpander {
4242
expander: MacroExpanderFn,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use ext::base::ExtCtxt;
1414
use ext::build::AstBuilder;
1515
use ext::deriving::generic::*;
1616

17-
pub fn expand_deriving_clone(cx: &ExtCtxt,
17+
pub fn expand_deriving_clone(cx: &mut ExtCtxt,
1818
span: Span,
1919
mitem: @MetaItem,
2020
in_items: ~[@Item])
@@ -42,7 +42,7 @@ pub fn expand_deriving_clone(cx: &ExtCtxt,
4242
trait_def.expand(mitem, in_items)
4343
}
4444

45-
pub fn expand_deriving_deep_clone(cx: &ExtCtxt,
45+
pub fn expand_deriving_deep_clone(cx: &mut ExtCtxt,
4646
span: Span,
4747
mitem: @MetaItem,
4848
in_items: ~[@Item])
@@ -74,7 +74,7 @@ pub fn expand_deriving_deep_clone(cx: &ExtCtxt,
7474

7575
fn cs_clone(
7676
name: &str,
77-
cx: &ExtCtxt, trait_span: Span,
77+
cx: &mut ExtCtxt, trait_span: Span,
7878
substr: &Substructure) -> @Expr {
7979
let clone_ident = substr.method_ident;
8080
let ctor_ident;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ use ext::base::ExtCtxt;
1414
use ext::build::AstBuilder;
1515
use ext::deriving::generic::*;
1616

17-
pub fn expand_deriving_eq(cx: &ExtCtxt,
17+
pub fn expand_deriving_eq(cx: &mut ExtCtxt,
1818
span: Span,
1919
mitem: @MetaItem,
2020
in_items: ~[@Item]) -> ~[@Item] {
2121
// structures are equal if all fields are equal, and non equal, if
2222
// any fields are not equal or if the enum variants are different
23-
fn cs_eq(cx: &ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
23+
fn cs_eq(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
2424
cs_and(|cx, span, _, _| cx.expr_bool(span, false),
2525
cx, span, substr)
2626
}
27-
fn cs_ne(cx: &ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
27+
fn cs_ne(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
2828
cs_or(|cx, span, _, _| cx.expr_bool(span, true),
2929
cx, span, substr)
3030
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use ext::base::ExtCtxt;
1515
use ext::build::AstBuilder;
1616
use ext::deriving::generic::*;
1717

18-
pub fn expand_deriving_ord(cx: &ExtCtxt,
18+
pub fn expand_deriving_ord(cx: &mut ExtCtxt,
1919
span: Span,
2020
mitem: @MetaItem,
2121
in_items: ~[@Item]) -> ~[@Item] {
@@ -51,7 +51,7 @@ pub fn expand_deriving_ord(cx: &ExtCtxt,
5151
}
5252

5353
/// Strict inequality.
54-
fn cs_op(less: bool, equal: bool, cx: &ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
54+
fn cs_op(less: bool, equal: bool, cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
5555
let op = if less {ast::BiLt} else {ast::BiGt};
5656
cs_fold(
5757
false, // need foldr,

branches/try2/src/libsyntax/ext/deriving/cmp/totaleq.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ use ext::base::ExtCtxt;
1414
use ext::build::AstBuilder;
1515
use ext::deriving::generic::*;
1616

17-
pub fn expand_deriving_totaleq(cx: &ExtCtxt,
17+
pub fn expand_deriving_totaleq(cx: &mut ExtCtxt,
1818
span: Span,
1919
mitem: @MetaItem,
2020
in_items: ~[@Item]) -> ~[@Item] {
21-
fn cs_equals(cx: &ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
21+
fn cs_equals(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
2222
cs_and(|cx, span, _, _| cx.expr_bool(span, false),
2323
cx, span, substr)
2424
}

branches/try2/src/libsyntax/ext/deriving/cmp/totalord.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use ext::build::AstBuilder;
1616
use ext::deriving::generic::*;
1717
use std::cmp::{Ordering, Equal, Less, Greater};
1818

19-
pub fn expand_deriving_totalord(cx: &ExtCtxt,
19+
pub fn expand_deriving_totalord(cx: &mut ExtCtxt,
2020
span: Span,
2121
mitem: @MetaItem,
2222
in_items: ~[@Item]) -> ~[@Item] {
@@ -44,7 +44,7 @@ pub fn expand_deriving_totalord(cx: &ExtCtxt,
4444
}
4545

4646

47-
pub fn ordering_const(cx: &ExtCtxt, span: Span, cnst: Ordering) -> ast::Path {
47+
pub fn ordering_const(cx: &mut ExtCtxt, span: Span, cnst: Ordering) -> ast::Path {
4848
let cnst = match cnst {
4949
Less => "Less",
5050
Equal => "Equal",
@@ -56,7 +56,7 @@ pub fn ordering_const(cx: &ExtCtxt, span: Span, cnst: Ordering) -> ast::Path {
5656
cx.ident_of(cnst)])
5757
}
5858

59-
pub fn cs_cmp(cx: &ExtCtxt, span: Span,
59+
pub fn cs_cmp(cx: &mut ExtCtxt, span: Span,
6060
substr: &Substructure) -> @Expr {
6161
let test_id = cx.ident_of("__test");
6262
let equals_path = ordering_const(cx, span, Equal);
@@ -106,8 +106,10 @@ pub fn cs_cmp(cx: &ExtCtxt, span: Span,
106106
// an earlier nonmatching variant is Less than a
107107
// later one.
108108
[(self_var, _, _),
109-
(other_var, _, _)] => cx.expr_path(ordering_const(cx, span,
110-
self_var.cmp(&other_var))),
109+
(other_var, _, _)] => {
110+
let order = ordering_const(cx, span, self_var.cmp(&other_var));
111+
cx.expr_path(order)
112+
}
111113
_ => cx.span_bug(span, "Not exactly 2 arguments in `deriving(TotalOrd)`")
112114
}
113115
},

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use ext::deriving::generic::*;
2121
use parse::token::InternedString;
2222
use parse::token;
2323

24-
pub fn expand_deriving_decodable(cx: &ExtCtxt,
24+
pub fn expand_deriving_decodable(cx: &mut ExtCtxt,
2525
span: Span,
2626
mitem: @MetaItem,
2727
in_items: ~[@Item]) -> ~[@Item] {
@@ -53,7 +53,7 @@ pub fn expand_deriving_decodable(cx: &ExtCtxt,
5353
trait_def.expand(mitem, in_items)
5454
}
5555

56-
fn decodable_substructure(cx: &ExtCtxt, trait_span: Span,
56+
fn decodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
5757
substr: &Substructure) -> @Expr {
5858
let decoder = substr.nonself_args[0];
5959
let recurse = ~[cx.ident_of("serialize"),
@@ -77,7 +77,7 @@ fn decodable_substructure(cx: &ExtCtxt, trait_span: Span,
7777
trait_span,
7878
substr.type_ident,
7979
summary,
80-
|span, name, field| {
80+
|cx, span, name, field| {
8181
cx.expr_method_call(span, blkdecoder, read_struct_field,
8282
~[cx.expr_str(span, name),
8383
cx.expr_uint(span, field),
@@ -108,10 +108,10 @@ fn decodable_substructure(cx: &ExtCtxt, trait_span: Span,
108108
v_span,
109109
name,
110110
parts,
111-
|span, _, field| {
111+
|cx, span, _, field| {
112+
let idx = cx.expr_uint(span, field);
112113
cx.expr_method_call(span, blkdecoder, rvariant_arg,
113-
~[cx.expr_uint(span, field),
114-
lambdadecode])
114+
~[idx, lambdadecode])
115115
});
116116

117117
arms.push(cx.arm(v_span,
@@ -143,19 +143,19 @@ fn decodable_substructure(cx: &ExtCtxt, trait_span: Span,
143143
/// Create a decoder for a single enum variant/struct:
144144
/// - `outer_pat_ident` is the name of this enum variant/struct
145145
/// - `getarg` should retrieve the `uint`-th field with name `@str`.
146-
fn decode_static_fields(cx: &ExtCtxt,
146+
fn decode_static_fields(cx: &mut ExtCtxt,
147147
trait_span: Span,
148148
outer_pat_ident: Ident,
149149
fields: &StaticFields,
150-
getarg: |Span, InternedString, uint| -> @Expr)
150+
getarg: |&mut ExtCtxt, Span, InternedString, uint| -> @Expr)
151151
-> @Expr {
152152
match *fields {
153153
Unnamed(ref fields) => {
154154
if fields.is_empty() {
155155
cx.expr_ident(trait_span, outer_pat_ident)
156156
} else {
157157
let fields = fields.iter().enumerate().map(|(i, &span)| {
158-
getarg(span,
158+
getarg(cx, span,
159159
token::intern_and_get_ident(format!("_field{}",
160160
i)),
161161
i)
@@ -167,9 +167,8 @@ fn decode_static_fields(cx: &ExtCtxt,
167167
Named(ref fields) => {
168168
// use the field's span to get nicer error messages.
169169
let fields = fields.iter().enumerate().map(|(i, &(name, span))| {
170-
cx.field_imm(span,
171-
name,
172-
getarg(span, token::get_ident(name.name), i))
170+
let arg = getarg(cx, span, token::get_ident(name.name), i);
171+
cx.field_imm(span, name, arg)
173172
}).collect();
174173
cx.expr_struct_ident(trait_span, outer_pat_ident, fields)
175174
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use ext::base::ExtCtxt;
1414
use ext::build::AstBuilder;
1515
use ext::deriving::generic::*;
1616

17-
pub fn expand_deriving_default(cx: &ExtCtxt,
17+
pub fn expand_deriving_default(cx: &mut ExtCtxt,
1818
span: Span,
1919
mitem: @MetaItem,
2020
in_items: ~[@Item])
@@ -41,7 +41,7 @@ pub fn expand_deriving_default(cx: &ExtCtxt,
4141
trait_def.expand(mitem, in_items)
4242
}
4343

44-
fn default_substructure(cx: &ExtCtxt, trait_span: Span, substr: &Substructure) -> @Expr {
44+
fn default_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> @Expr {
4545
let default_ident = ~[
4646
cx.ident_of("std"),
4747
cx.ident_of("default"),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ use ext::build::AstBuilder;
8282
use ext::deriving::generic::*;
8383
use parse::token;
8484

85-
pub fn expand_deriving_encodable(cx: &ExtCtxt,
85+
pub fn expand_deriving_encodable(cx: &mut ExtCtxt,
8686
span: Span,
8787
mitem: @MetaItem,
8888
in_items: ~[@Item]) -> ~[@Item] {
@@ -114,7 +114,7 @@ pub fn expand_deriving_encodable(cx: &ExtCtxt,
114114
trait_def.expand(mitem, in_items)
115115
}
116116

117-
fn encodable_substructure(cx: &ExtCtxt, trait_span: Span,
117+
fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
118118
substr: &Substructure) -> @Expr {
119119
let encoder = substr.nonself_args[0];
120120
// throw an underscore in front to suppress unused variable warnings

branches/try2/src/libsyntax/ext/deriving/generic.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ mod ty;
194194

195195
pub struct TraitDef<'a> {
196196
/// The extension context
197-
cx: &'a ExtCtxt<'a>,
197+
cx: &'a mut ExtCtxt<'a>,
198198
/// The span for the current #[deriving(Foo)] header.
199199
span: Span,
200200

@@ -304,15 +304,15 @@ Combine the values of all the fields together. The last argument is
304304
all the fields of all the structures, see above for details.
305305
*/
306306
pub type CombineSubstructureFunc<'a> =
307-
'a |&ExtCtxt, Span, &Substructure| -> @Expr;
307+
'a |&mut ExtCtxt, Span, &Substructure| -> @Expr;
308308

309309
/**
310310
Deal with non-matching enum variants, the arguments are a list
311311
representing each variant: (variant index, ast::Variant instance,
312312
[variant fields]), and a list of the nonself args of the type
313313
*/
314314
pub type EnumNonMatchFunc<'a> =
315-
'a |&ExtCtxt,
315+
'a |&mut ExtCtxt,
316316
Span,
317317
&[(uint, P<ast::Variant>, ~[(Span, Option<Ident>, @Expr)])],
318318
&[@Expr]|
@@ -356,7 +356,7 @@ impl<'a> TraitDef<'a> {
356356
fn create_derived_impl(&self,
357357
type_ident: Ident, generics: &Generics,
358358
methods: ~[@ast::Method]) -> @ast::Item {
359-
let cx = self.cx;
359+
let cx = &*self.cx;
360360
let trait_path = self.path.to_path(cx, self.span, type_ident, generics);
361361

362362
let mut trait_generics = self.generics.to_generics(cx, self.span,
@@ -764,7 +764,7 @@ impl<'a> MethodDef<'a> {
764764
matches_so_far: &mut ~[(uint, P<ast::Variant>,
765765
~[(Span, Option<Ident>, @Expr)])],
766766
match_count: uint) -> @Expr {
767-
let cx = trait_.cx;
767+
let cx = &trait_.cx;
768768
if match_count == self_args.len() {
769769
// we've matched against all arguments, so make the final
770770
// expression at the bottom of the match tree
@@ -990,7 +990,7 @@ impl<'a> TraitDef<'a> {
990990
prefix: &str,
991991
mutbl: ast::Mutability)
992992
-> (@ast::Pat, ~[(Span, Option<Ident>, @Expr)]) {
993-
let cx = self.cx;
993+
let cx = &self.cx;
994994

995995
if struct_def.fields.is_empty() {
996996
return (
@@ -1050,7 +1050,7 @@ impl<'a> TraitDef<'a> {
10501050
prefix: &str,
10511051
mutbl: ast::Mutability)
10521052
-> (@ast::Pat, ~[(Span, Option<Ident>, @Expr)]) {
1053-
let cx = self.cx;
1053+
let cx = &*self.cx;
10541054
let variant_ident = variant.node.name;
10551055
match variant.node.kind {
10561056
ast::TupleVariantKind(ref variant_args) => {
@@ -1093,10 +1093,10 @@ Fold the fields. `use_foldl` controls whether this is done
10931093
left-to-right (`true`) or right-to-left (`false`).
10941094
*/
10951095
pub fn cs_fold(use_foldl: bool,
1096-
f: |&ExtCtxt, Span, @Expr, @Expr, &[@Expr]| -> @Expr,
1096+
f: |&mut ExtCtxt, Span, @Expr, @Expr, &[@Expr]| -> @Expr,
10971097
base: @Expr,
10981098
enum_nonmatch_f: EnumNonMatchFunc,
1099-
cx: &ExtCtxt,
1099+
cx: &mut ExtCtxt,
11001100
trait_span: Span,
11011101
substructure: &Substructure)
11021102
-> @Expr {
@@ -1132,9 +1132,9 @@ f(cx, span, ~[self_1.method(__arg_1_1, __arg_2_1),
11321132
~~~
11331133
*/
11341134
#[inline]
1135-
pub fn cs_same_method(f: |&ExtCtxt, Span, ~[@Expr]| -> @Expr,
1135+
pub fn cs_same_method(f: |&mut ExtCtxt, Span, ~[@Expr]| -> @Expr,
11361136
enum_nonmatch_f: EnumNonMatchFunc,
1137-
cx: &ExtCtxt,
1137+
cx: &mut ExtCtxt,
11381138
trait_span: Span,
11391139
substructure: &Substructure)
11401140
-> @Expr {
@@ -1166,10 +1166,10 @@ fields. `use_foldl` controls whether this is done left-to-right
11661166
*/
11671167
#[inline]
11681168
pub fn cs_same_method_fold(use_foldl: bool,
1169-
f: |&ExtCtxt, Span, @Expr, @Expr| -> @Expr,
1169+
f: |&mut ExtCtxt, Span, @Expr, @Expr| -> @Expr,
11701170
base: @Expr,
11711171
enum_nonmatch_f: EnumNonMatchFunc,
1172-
cx: &ExtCtxt,
1172+
cx: &mut ExtCtxt,
11731173
trait_span: Span,
11741174
substructure: &Substructure)
11751175
-> @Expr {
@@ -1196,7 +1196,7 @@ on all the fields.
11961196
#[inline]
11971197
pub fn cs_binop(binop: ast::BinOp, base: @Expr,
11981198
enum_nonmatch_f: EnumNonMatchFunc,
1199-
cx: &ExtCtxt, trait_span: Span,
1199+
cx: &mut ExtCtxt, trait_span: Span,
12001200
substructure: &Substructure) -> @Expr {
12011201
cs_same_method_fold(
12021202
true, // foldl is good enough
@@ -1214,7 +1214,7 @@ pub fn cs_binop(binop: ast::BinOp, base: @Expr,
12141214
/// cs_binop with binop == or
12151215
#[inline]
12161216
pub fn cs_or(enum_nonmatch_f: EnumNonMatchFunc,
1217-
cx: &ExtCtxt, span: Span,
1217+
cx: &mut ExtCtxt, span: Span,
12181218
substructure: &Substructure) -> @Expr {
12191219
cs_binop(ast::BiOr, cx.expr_bool(span, false),
12201220
enum_nonmatch_f,
@@ -1224,7 +1224,7 @@ pub fn cs_or(enum_nonmatch_f: EnumNonMatchFunc,
12241224
/// cs_binop with binop == and
12251225
#[inline]
12261226
pub fn cs_and(enum_nonmatch_f: EnumNonMatchFunc,
1227-
cx: &ExtCtxt, span: Span,
1227+
cx: &mut ExtCtxt, span: Span,
12281228
substructure: &Substructure) -> @Expr {
12291229
cs_binop(ast::BiAnd, cx.expr_bool(span, true),
12301230
enum_nonmatch_f,

branches/try2/src/libsyntax/ext/deriving/iter_bytes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use ext::build::AstBuilder;
1515
use ext::deriving::generic::*;
1616

1717

18-
pub fn expand_deriving_iter_bytes(cx: &ExtCtxt,
18+
pub fn expand_deriving_iter_bytes(cx: &mut ExtCtxt,
1919
span: Span,
2020
mitem: @MetaItem,
2121
in_items: ~[@Item]) -> ~[@Item] {
@@ -45,7 +45,7 @@ pub fn expand_deriving_iter_bytes(cx: &ExtCtxt,
4545
trait_def.expand(mitem, in_items)
4646
}
4747

48-
fn iter_bytes_substructure(cx: &ExtCtxt, trait_span: Span, substr: &Substructure) -> @Expr {
48+
fn iter_bytes_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> @Expr {
4949
let (lsb0, f)= match substr.nonself_args {
5050
[l, f] => (l, f),
5151
_ => cx.span_bug(trait_span, "Incorrect number of arguments in `deriving(IterBytes)`")

0 commit comments

Comments
 (0)