Skip to content

Commit 6df2b4e

Browse files
committed
---
yaml --- r: 44788 b: refs/heads/master c: 5271464 h: refs/heads/master v: v3
1 parent 73fe13c commit 6df2b4e

File tree

18 files changed

+152
-125
lines changed

18 files changed

+152
-125
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: 5f1652f34fee38f3d88f5944c86f159c0f7d7fee
2+
refs/heads/master: 5271464cc0aae453e96ad70a33e0c9636df7f90e
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
55
refs/heads/try: ef355f6332f83371e4acf04fc4eb940ab41d78d3

trunk/src/libsyntax/ext/auto_encode.rs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ pub fn expand_auto_encode(
143143
cx,
144144
item.span,
145145
item.ident,
146-
*enum_def,
147-
*tps
146+
copy *enum_def,
147+
copy *tps
148148
);
149149

150150
~[filter_attrs(*item), ser_impl]
@@ -188,7 +188,7 @@ pub fn expand_auto_decode(
188188
item.span,
189189
item.ident,
190190
struct_def.fields,
191-
*tps
191+
copy *tps
192192
);
193193

194194
~[filter_attrs(*item), deser_impl]
@@ -198,8 +198,8 @@ pub fn expand_auto_decode(
198198
cx,
199199
item.span,
200200
item.ident,
201-
*enum_def,
202-
*tps
201+
copy *enum_def,
202+
copy *tps
203203
);
204204

205205
~[filter_attrs(*item), deser_impl]
@@ -346,7 +346,7 @@ priv impl ext_ctxt {
346346

347347
fn lambda(+blk: ast::blk) -> @ast::expr {
348348
let ext_cx = self;
349-
let blk_e = self.expr(blk.span, ast::expr_block(blk));
349+
let blk_e = self.expr(copy blk.span, ast::expr_block(copy blk));
350350
quote_expr!( || $blk_e )
351351
}
352352

@@ -840,14 +840,14 @@ fn mk_enum_ser_impl(
840840
cx: ext_ctxt,
841841
span: span,
842842
ident: ast::ident,
843-
enum_def: ast::enum_def,
843+
+enum_def: ast::enum_def,
844844
tps: ~[ast::ty_param]
845845
) -> @ast::item {
846846
let body = mk_enum_ser_body(
847847
cx,
848848
span,
849849
ident,
850-
enum_def.variants
850+
copy enum_def.variants
851851
);
852852
853853
mk_ser_impl(cx, span, ident, tps, body)
@@ -857,7 +857,7 @@ fn mk_enum_deser_impl(
857857
cx: ext_ctxt,
858858
span: span,
859859
ident: ast::ident,
860-
enum_def: ast::enum_def,
860+
+enum_def: ast::enum_def,
861861
tps: ~[ast::ty_param]
862862
) -> @ast::item {
863863
let body = mk_enum_deser_body(
@@ -960,8 +960,14 @@ fn mk_enum_ser_body(
960960
) -> @ast::expr {
961961
let arms = do variants.mapi |v_idx, variant| {
962962
match variant.node.kind {
963-
ast::tuple_variant_kind(args) =>
964-
ser_variant(cx, span, variant.node.name, v_idx, args),
963+
ast::tuple_variant_kind(ref args) =>
964+
ser_variant(
965+
cx,
966+
span,
967+
variant.node.name,
968+
v_idx,
969+
/*bad*/ copy *args
970+
),
965971
ast::struct_variant_kind(*) =>
966972
fail!(~"struct variants unimplemented"),
967973
ast::enum_variant_kind(*) =>
@@ -1041,7 +1047,7 @@ fn mk_enum_deser_body(
10411047
) -> @ast::expr {
10421048
let mut arms = do variants.mapi |v_idx, variant| {
10431049
let body = match variant.node.kind {
1044-
ast::tuple_variant_kind(args) => {
1050+
ast::tuple_variant_kind(ref args) => {
10451051
if args.is_empty() {
10461052
// for a nullary variant v, do "v"
10471053
ext_cx.expr_path(span, ~[variant.node.name])
@@ -1051,7 +1057,7 @@ fn mk_enum_deser_body(
10511057
ext_cx,
10521058
span,
10531059
variant.node.name,
1054-
args
1060+
copy *args
10551061
)
10561062
}
10571063
},
@@ -1074,7 +1080,7 @@ fn mk_enum_deser_body(
10741080
}
10751081
};
10761082
1077-
let quoted_expr = quote_expr!(
1083+
let quoted_expr = copy quote_expr!(
10781084
::core::sys::begin_unwind(~"explicit failure", ~"empty", 1);
10791085
).node;
10801086

trunk/src/libsyntax/ext/base.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ pub trait ext_ctxt {
192192
}
193193

194194
pub fn mk_ctxt(parse_sess: @mut parse::ParseSess,
195-
cfg: ast::crate_cfg) -> ext_ctxt {
195+
+cfg: ast::crate_cfg) -> ext_ctxt {
196196
struct CtxtRepr {
197197
parse_sess: @mut parse::ParseSess,
198198
cfg: ast::crate_cfg,
@@ -203,7 +203,7 @@ pub fn mk_ctxt(parse_sess: @mut parse::ParseSess,
203203
impl ext_ctxt for CtxtRepr {
204204
fn codemap(@mut self) -> @CodeMap { self.parse_sess.cm }
205205
fn parse_sess(@mut self) -> @mut parse::ParseSess { self.parse_sess }
206-
fn cfg(@mut self) -> ast::crate_cfg { self.cfg }
206+
fn cfg(@mut self) -> ast::crate_cfg { copy self.cfg }
207207
fn call_site(@mut self) -> span {
208208
match *self.backtrace {
209209
Some(@ExpandedFrom(CallInfo {call_site: cs, _})) => cs,
@@ -214,15 +214,15 @@ pub fn mk_ctxt(parse_sess: @mut parse::ParseSess,
214214
fn backtrace(@mut self) -> Option<@ExpnInfo> { *self.backtrace }
215215
fn mod_push(@mut self, i: ast::ident) { self.mod_path.push(i); }
216216
fn mod_pop(@mut self) { self.mod_path.pop(); }
217-
fn mod_path(@mut self) -> ~[ast::ident] { return self.mod_path; }
217+
fn mod_path(@mut self) -> ~[ast::ident] { copy self.mod_path }
218218
fn bt_push(@mut self, ei: codemap::ExpnInfo) {
219219
match ei {
220220
ExpandedFrom(CallInfo {call_site: cs, callee: ref callee}) => {
221221
*self.backtrace =
222222
Some(@ExpandedFrom(CallInfo {
223223
call_site: span {lo: cs.lo, hi: cs.hi,
224224
expn_info: *self.backtrace},
225-
callee: (*callee)}));
225+
callee: copy *callee}));
226226
}
227227
}
228228
}
@@ -269,12 +269,11 @@ pub fn mk_ctxt(parse_sess: @mut parse::ParseSess,
269269
fn set_trace_macros(@mut self, x: bool) {
270270
self.trace_mac = x
271271
}
272-
273272
fn str_of(@mut self, id: ast::ident) -> ~str {
274-
*self.parse_sess.interner.get(id)
273+
copy *self.parse_sess.interner.get(id)
275274
}
276275
fn ident_of(@mut self, st: ~str) -> ast::ident {
277-
self.parse_sess.interner.intern(@st)
276+
self.parse_sess.interner.intern(@/*bad*/ copy st)
278277
}
279278
}
280279
let imp: @mut CtxtRepr = @mut CtxtRepr {
@@ -290,7 +289,7 @@ pub fn mk_ctxt(parse_sess: @mut parse::ParseSess,
290289
pub fn expr_to_str(cx: ext_ctxt, expr: @ast::expr, err_msg: ~str) -> ~str {
291290
match expr.node {
292291
ast::expr_lit(l) => match l.node {
293-
ast::lit_str(s) => return *s,
292+
ast::lit_str(s) => copy *s,
294293
_ => cx.span_fatal(l.span, err_msg)
295294
},
296295
_ => cx.span_fatal(expr.span, err_msg)

trunk/src/libsyntax/ext/build.rs

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub struct Field {
2626

2727
pub fn mk_expr(cx: ext_ctxt,
2828
sp: codemap::span,
29-
expr: ast::expr_)
29+
+expr: ast::expr_)
3030
-> @ast::expr {
3131
@ast::expr {
3232
id: cx.next_id(),
@@ -62,7 +62,7 @@ pub fn mk_unary(cx: ext_ctxt, sp: span, op: ast::unop, e: @ast::expr)
6262
cx.next_id(); // see ast_util::op_expr_callee_id
6363
mk_expr(cx, sp, ast::expr_unary(op, e))
6464
}
65-
pub fn mk_raw_path(sp: span, idents: ~[ast::ident]) -> @ast::path {
65+
pub fn mk_raw_path(sp: span, +idents: ~[ast::ident]) -> @ast::path {
6666
let p = @ast::path { span: sp,
6767
global: false,
6868
idents: idents,
@@ -71,7 +71,7 @@ pub fn mk_raw_path(sp: span, idents: ~[ast::ident]) -> @ast::path {
7171
return p;
7272
}
7373
pub fn mk_raw_path_(sp: span,
74-
idents: ~[ast::ident],
74+
+idents: ~[ast::ident],
7575
+types: ~[@ast::Ty])
7676
-> @ast::path {
7777
@ast::path { span: sp,
@@ -80,25 +80,25 @@ pub fn mk_raw_path_(sp: span,
8080
rp: None,
8181
types: types }
8282
}
83-
pub fn mk_raw_path_global(sp: span, idents: ~[ast::ident]) -> @ast::path {
83+
pub fn mk_raw_path_global(sp: span, +idents: ~[ast::ident]) -> @ast::path {
8484
@ast::path { span: sp,
8585
global: true,
8686
idents: idents,
8787
rp: None,
8888
types: ~[] }
8989
}
90-
pub fn mk_path(cx: ext_ctxt, sp: span, idents: ~[ast::ident]) -> @ast::expr {
90+
pub fn mk_path(cx: ext_ctxt, sp: span, +idents: ~[ast::ident]) -> @ast::expr {
9191
mk_expr(cx, sp, ast::expr_path(mk_raw_path(sp, idents)))
9292
}
93-
pub fn mk_path_global(cx: ext_ctxt, sp: span, idents: ~[ast::ident])
93+
pub fn mk_path_global(cx: ext_ctxt, sp: span, +idents: ~[ast::ident])
9494
-> @ast::expr {
9595
mk_expr(cx, sp, ast::expr_path(mk_raw_path_global(sp, idents)))
9696
}
9797
pub fn mk_access_(cx: ext_ctxt, sp: span, p: @ast::expr, m: ast::ident)
9898
-> @ast::expr {
9999
mk_expr(cx, sp, ast::expr_field(p, m, ~[]))
100100
}
101-
pub fn mk_access(cx: ext_ctxt, sp: span, p: ~[ast::ident], m: ast::ident)
101+
pub fn mk_access(cx: ext_ctxt, sp: span, +p: ~[ast::ident], m: ast::ident)
102102
-> @ast::expr {
103103
let pathexpr = mk_path(cx, sp, p);
104104
return mk_access_(cx, sp, pathexpr, m);
@@ -107,21 +107,21 @@ pub fn mk_addr_of(cx: ext_ctxt, sp: span, e: @ast::expr) -> @ast::expr {
107107
return mk_expr(cx, sp, ast::expr_addr_of(ast::m_imm, e));
108108
}
109109
pub fn mk_call_(cx: ext_ctxt, sp: span, fn_expr: @ast::expr,
110-
args: ~[@ast::expr]) -> @ast::expr {
110+
+args: ~[@ast::expr]) -> @ast::expr {
111111
mk_expr(cx, sp, ast::expr_call(fn_expr, args, ast::NoSugar))
112112
}
113-
pub fn mk_call(cx: ext_ctxt, sp: span, fn_path: ~[ast::ident],
114-
args: ~[@ast::expr]) -> @ast::expr {
113+
pub fn mk_call(cx: ext_ctxt, sp: span, +fn_path: ~[ast::ident],
114+
+args: ~[@ast::expr]) -> @ast::expr {
115115
let pathexpr = mk_path(cx, sp, fn_path);
116116
return mk_call_(cx, sp, pathexpr, args);
117117
}
118-
pub fn mk_call_global(cx: ext_ctxt, sp: span, fn_path: ~[ast::ident],
119-
args: ~[@ast::expr]) -> @ast::expr {
118+
pub fn mk_call_global(cx: ext_ctxt, sp: span, +fn_path: ~[ast::ident],
119+
+args: ~[@ast::expr]) -> @ast::expr {
120120
let pathexpr = mk_path_global(cx, sp, fn_path);
121121
return mk_call_(cx, sp, pathexpr, args);
122122
}
123123
// e = expr, t = type
124-
pub fn mk_base_vec_e(cx: ext_ctxt, sp: span, exprs: ~[@ast::expr])
124+
pub fn mk_base_vec_e(cx: ext_ctxt, sp: span, +exprs: ~[@ast::expr])
125125
-> @ast::expr {
126126
let vecexpr = ast::expr_vec(exprs, ast::m_imm);
127127
mk_expr(cx, sp, vecexpr)
@@ -131,25 +131,25 @@ pub fn mk_vstore_e(cx: ext_ctxt, sp: span, expr: @ast::expr,
131131
@ast::expr {
132132
mk_expr(cx, sp, ast::expr_vstore(expr, vst))
133133
}
134-
pub fn mk_uniq_vec_e(cx: ext_ctxt, sp: span, exprs: ~[@ast::expr])
134+
pub fn mk_uniq_vec_e(cx: ext_ctxt, sp: span, +exprs: ~[@ast::expr])
135135
-> @ast::expr {
136136
mk_vstore_e(cx, sp, mk_base_vec_e(cx, sp, exprs), ast::expr_vstore_uniq)
137137
}
138-
pub fn mk_slice_vec_e(cx: ext_ctxt, sp: span, exprs: ~[@ast::expr])
138+
pub fn mk_slice_vec_e(cx: ext_ctxt, sp: span, +exprs: ~[@ast::expr])
139139
-> @ast::expr {
140140
mk_vstore_e(cx, sp, mk_base_vec_e(cx, sp, exprs),
141141
ast::expr_vstore_slice)
142142
}
143-
pub fn mk_fixed_vec_e(cx: ext_ctxt, sp: span, exprs: ~[@ast::expr])
143+
pub fn mk_fixed_vec_e(cx: ext_ctxt, sp: span, +exprs: ~[@ast::expr])
144144
-> @ast::expr {
145145
mk_vstore_e(cx, sp, mk_base_vec_e(cx, sp, exprs),
146146
ast::expr_vstore_fixed(None))
147147
}
148-
pub fn mk_base_str(cx: ext_ctxt, sp: span, s: ~str) -> @ast::expr {
148+
pub fn mk_base_str(cx: ext_ctxt, sp: span, +s: ~str) -> @ast::expr {
149149
let lit = ast::lit_str(@s);
150150
return mk_lit(cx, sp, lit);
151151
}
152-
pub fn mk_uniq_str(cx: ext_ctxt, sp: span, s: ~str) -> @ast::expr {
152+
pub fn mk_uniq_str(cx: ext_ctxt, sp: span, +s: ~str) -> @ast::expr {
153153
mk_vstore_e(cx, sp, mk_base_str(cx, sp, s), ast::expr_vstore_uniq)
154154
}
155155
pub fn mk_field(sp: span, f: &Field) -> ast::field {
@@ -161,28 +161,36 @@ pub fn mk_field(sp: span, f: &Field) -> ast::field {
161161
pub fn mk_fields(sp: span, fields: ~[Field]) -> ~[ast::field] {
162162
fields.map(|f| mk_field(sp, f))
163163
}
164-
pub fn mk_rec_e(cx: ext_ctxt, sp: span, fields: ~[Field]) -> @ast::expr {
164+
pub fn mk_rec_e(cx: ext_ctxt,
165+
sp: span,
166+
+fields: ~[Field])
167+
-> @ast::expr {
165168
mk_expr(cx, sp, ast::expr_rec(mk_fields(sp, fields),
166169
option::None::<@ast::expr>))
167170
}
168-
pub fn mk_struct_e(cx: ext_ctxt, sp: span, ctor_path: ~[ast::ident],
169-
fields: ~[Field]) -> @ast::expr {
171+
pub fn mk_struct_e(cx: ext_ctxt,
172+
sp: span,
173+
+ctor_path: ~[ast::ident],
174+
+fields: ~[Field])
175+
-> @ast::expr {
170176
mk_expr(cx, sp,
171177
ast::expr_struct(mk_raw_path(sp, ctor_path),
172178
mk_fields(sp, fields),
173179
option::None::<@ast::expr>))
174180
}
175-
pub fn mk_global_struct_e(cx: ext_ctxt, sp: span,
176-
ctor_path: ~[ast::ident],
177-
fields: ~[Field])
181+
pub fn mk_global_struct_e(cx: ext_ctxt,
182+
sp: span,
183+
+ctor_path: ~[ast::ident],
184+
+fields: ~[Field])
178185
-> @ast::expr {
179186
mk_expr(cx, sp,
180187
ast::expr_struct(mk_raw_path_global(sp, ctor_path),
181188
mk_fields(sp, fields),
182189
option::None::<@ast::expr>))
183190
}
184-
pub fn mk_glob_use(cx: ext_ctxt, sp: span, path: ~[ast::ident])
185-
-> @ast::view_item {
191+
pub fn mk_glob_use(cx: ext_ctxt,
192+
sp: span,
193+
+path: ~[ast::ident]) -> @ast::view_item {
186194
let glob = @codemap::spanned {
187195
node: ast::view_path_glob(mk_raw_path(sp, path), cx.next_id()),
188196
span: sp,
@@ -218,8 +226,8 @@ pub fn mk_local(cx: ext_ctxt, sp: span, mutbl: bool,
218226
@codemap::spanned { node: ast::stmt_decl(@decl, cx.next_id()), span: sp }
219227
}
220228
pub fn mk_block(cx: ext_ctxt, span: span,
221-
view_items: ~[@ast::view_item],
222-
stmts: ~[@ast::stmt],
229+
+view_items: ~[@ast::view_item],
230+
+stmts: ~[@ast::stmt],
223231
expr: Option<@ast::expr>) -> @ast::expr {
224232
let blk = codemap::spanned {
225233
node: ast::blk_ {
@@ -313,7 +321,7 @@ pub fn mk_stmt(cx: ext_ctxt, span: span, expr: @ast::expr) -> @ast::stmt {
313321
}
314322
pub fn mk_ty_path(cx: ext_ctxt,
315323
span: span,
316-
idents: ~[ ast::ident ])
324+
+idents: ~[ ast::ident ])
317325
-> @ast::Ty {
318326
let ty = build::mk_raw_path(span, idents);
319327
let ty = ast::ty_path(ty, cx.next_id());
@@ -322,7 +330,7 @@ pub fn mk_ty_path(cx: ext_ctxt,
322330
}
323331
pub fn mk_ty_path_global(cx: ext_ctxt,
324332
span: span,
325-
idents: ~[ ast::ident ])
333+
+idents: ~[ ast::ident ])
326334
-> @ast::Ty {
327335
let ty = build::mk_raw_path_global(span, idents);
328336
let ty = ast::ty_path(ty, cx.next_id());

trunk/src/libsyntax/ext/deriving.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,8 @@ fn call_substructure_iter_bytes_method(cx: ext_ctxt,
472472

473473
fn variant_arg_count(cx: ext_ctxt, span: span, variant: &variant) -> uint {
474474
match variant.node.kind {
475-
tuple_variant_kind(args) => args.len(),
476-
struct_variant_kind(struct_def) => struct_def.fields.len(),
475+
tuple_variant_kind(ref args) => args.len(),
476+
struct_variant_kind(ref struct_def) => struct_def.fields.len(),
477477
enum_variant_kind(*) => {
478478
cx.span_bug(span, ~"variant_arg_count: enum variants deprecated")
479479
}

trunk/src/libsyntax/ext/env.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ pub fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
3131
// Option<str> rather than just an maybe-empty string.
3232

3333
let e = match os::getenv(var) {
34-
option::None => mk_uniq_str(cx, sp, ~""),
35-
option::Some(ref s) => mk_uniq_str(cx, sp, (*s))
34+
None => mk_uniq_str(cx, sp, ~""),
35+
Some(ref s) => mk_uniq_str(cx, sp, copy *s)
3636
};
3737
MRExpr(e)
3838
}

0 commit comments

Comments
 (0)