Skip to content

Commit cca7640

Browse files
committed
---
yaml --- r: 2950 b: refs/heads/master c: 2b334f0 h: refs/heads/master v: v3
1 parent d876fc9 commit cca7640

File tree

5 files changed

+54
-49
lines changed

5 files changed

+54
-49
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 4d8f715dab7862b4ad1f0c856f0e3cdd554e212a
2+
refs/heads/master: 2b334f061a7e7e7ff766f934081bc40ebfdaa698

trunk/src/comp/middle/resolve.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ fn map_crate(&@env e, &ast::crate c) {
150150
fn index_vi(@env e, @mutable list[scope] sc, &@ast::view_item i) {
151151
alt (i.node) {
152152
case (ast::view_item_import(_, ?ids, ?defid)) {
153-
e.imports.insert(defid._1, todo(i, *sc));
153+
e.imports.insert(defid._1, todo(i, {*sc}));
154154
}
155155
case (_) {}
156156
}
@@ -231,7 +231,7 @@ fn map_crate(&@env e, &ast::crate c) {
231231
//if it really is a glob import, that is
232232
case (ast::view_item_import_glob(?path, _)) {
233233
find_mod(e, *sc).glob_imports
234-
+= [follow_import(*e, *sc, path, vi.span)];
234+
+= [follow_import(*e, {*sc}, path, vi.span)];
235235
}
236236
case (_) {}
237237
}
@@ -275,8 +275,8 @@ fn resolve_names(&@env e, &ast::crate c) {
275275
push_env_for_expr(sc, exp);
276276
alt (exp.node) {
277277
case (ast::expr_path(?p, ?a)) {
278-
auto df = lookup_path_strict(*e, *sc, exp.span, p.node.idents,
279-
ns_value);
278+
auto df = lookup_path_strict(*e, {*sc}, exp.span,
279+
p.node.idents, ns_value);
280280
e.def_map.insert(a.id, df);
281281
}
282282
case (_) {}
@@ -285,15 +285,15 @@ fn resolve_names(&@env e, &ast::crate c) {
285285
fn walk_ty(@env e, @mutable list[scope] sc, &@ast::ty t) {
286286
alt (t.node) {
287287
case (ast::ty_path(?p, ?a)) {
288-
auto new_def = lookup_path_strict(*e, *sc, t.span,
288+
auto new_def = lookup_path_strict(*e, {*sc}, t.span,
289289
p.node.idents, ns_type);
290290
e.def_map.insert(a.id, new_def);
291291
}
292292
case (_) {}
293293
}
294294
}
295295
fn walk_arm(@env e, @mutable list[scope] sc, &ast::arm a) {
296-
walk_pat(*e, *sc, a.pat);
296+
walk_pat(*e, {*sc}, a.pat);
297297
push_env_for_arm(sc, a);
298298
}
299299
fn walk_pat(&env e, &list[scope] sc, &@ast::pat pat) {
@@ -325,14 +325,14 @@ fn push_env_for_crate(@mutable list[scope] sc, &ast::crate c) {
325325
*sc = cons[scope](scope_crate(@c), @*sc);
326326
}
327327
fn pop_env_for_crate(@mutable list[scope] sc, &ast::crate c) {
328-
*sc = std::list::cdr(*sc);
328+
*sc = std::list::cdr({*sc});
329329
}
330330

331331
fn push_env_for_item(@mutable list[scope] sc, &@ast::item i) {
332332
*sc = cons[scope](scope_item(i), @*sc);
333333
}
334334
fn pop_env_for_item(@mutable list[scope] sc, &@ast::item i) {
335-
*sc = std::list::cdr(*sc);
335+
*sc = std::list::cdr({*sc});
336336
}
337337

338338
fn push_env_for_method(@mutable list[scope] sc, &@ast::method m) {
@@ -346,21 +346,21 @@ fn push_env_for_method(@mutable list[scope] sc, &@ast::method m) {
346346
*sc = cons[scope](scope_item(i), @*sc);
347347
}
348348
fn pop_env_for_method(@mutable list[scope] sc, &@ast::method m) {
349-
*sc = std::list::cdr(*sc);
349+
*sc = std::list::cdr({*sc});
350350
}
351351

352352
fn push_env_for_n_item(@mutable list[scope] sc, &@ast::native_item i) {
353353
*sc = cons[scope](scope_native_item(i), @*sc);
354354
}
355355
fn pop_env_for_n_item(@mutable list[scope] sc, &@ast::native_item i) {
356-
*sc = std::list::cdr(*sc);
356+
*sc = std::list::cdr({*sc});
357357
}
358358

359359
fn push_env_for_block(@mutable list[scope] sc, &ast::block b) {
360360
*sc = cons[scope](scope_block(b), @*sc);
361361
}
362362
fn pop_env_for_block(@mutable list[scope] sc, &ast::block b) {
363-
*sc = std::list::cdr(*sc);
363+
*sc = std::list::cdr({*sc});
364364
}
365365

366366
fn push_env_for_expr(@mutable list[scope] sc, &@ast::expr x) {
@@ -377,10 +377,10 @@ fn push_env_for_expr(@mutable list[scope] sc, &@ast::expr x) {
377377
fn pop_env_for_expr(@mutable list[scope] sc, &@ast::expr x) {
378378
alt (x.node) {
379379
case (ast::expr_for(?d, _, _, _)) {
380-
*sc = std::list::cdr(*sc);
380+
*sc = std::list::cdr({*sc});
381381
}
382382
case (ast::expr_for_each(?d, _, _, _)) {
383-
*sc = std::list::cdr(*sc);
383+
*sc = std::list::cdr({*sc});
384384
}
385385
case (_) {}
386386
}
@@ -390,7 +390,7 @@ fn push_env_for_arm(@mutable list[scope] sc, &ast::arm p) {
390390
*sc = cons[scope](scope_arm(p), @*sc);
391391
}
392392
fn pop_env_for_arm(@mutable list[scope] sc, &ast::arm p) {
393-
*sc = std::list::cdr(*sc);
393+
*sc = std::list::cdr({*sc});
394394
}
395395

396396
fn follow_import(&env e, &list[scope] sc, vec[ident] path, &span sp)
@@ -613,7 +613,7 @@ fn lookup_in_scope(&env e, list[scope] sc, &span sp, &ident id, namespace ns)
613613
// Used to determine whether obj fields are in scope
614614
auto left_fn_level2 = false;
615615
while (true) {
616-
alt (sc) {
616+
alt ({sc}) {
617617
case (nil) {
618618
ret none[def];
619619
}
@@ -869,7 +869,7 @@ fn lookup_in_local_mod(&env e, def_id defid, &span sp,
869869
case (none) { }
870870
case (some(?lst)) {
871871
while (true) {
872-
alt (lst) {
872+
alt ({lst}) {
873873
case (nil) { break; }
874874
case (cons(?hd, ?tl)) {
875875
auto found = lookup_in_mie(e, hd, ns);
@@ -1126,7 +1126,7 @@ fn check_mod_name(&env e, &ident name, &list[mod_index_entry] entries) {
11261126
}
11271127

11281128
while (true) {
1129-
alt (entries) {
1129+
alt ({entries}) {
11301130
case (cons(?entry, ?rest)) {
11311131
if (!option::is_none(lookup_in_mie(e, entry, ns_value))) {
11321132
if (saw_value) { dup(e, mie_span(entry), "", name); }

trunk/src/comp/middle/trans.rs

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ type val_self_pair = rec(ValueRef v, ty::t t);
150150
type ty_self_pair = tup(TypeRef, ty::t);
151151

152152
// Function context. Every LLVM function we create will have one of these.
153-
state type fn_ctxt = rec(
153+
type fn_ctxt = rec(
154154
// The ValueRef returned from a call to llvm::LLVMAddFunction; the address
155155
// of the first instruction in the sequence of instructions for this
156156
// function that will go in the .text section of the executable we're
@@ -305,8 +305,8 @@ tag block_parent {
305305
}
306306

307307

308-
state type result = rec(mutable @block_ctxt bcx,
309-
mutable ValueRef val);
308+
state type result = rec(@block_ctxt bcx,
309+
ValueRef val);
310310

311311
fn sep() -> str {
312312
ret "_";
@@ -364,8 +364,8 @@ fn mangle_name_by_seq(&@crate_ctxt ccx, &vec[str] path,
364364
}
365365

366366
fn res(@block_ctxt bcx, ValueRef val) -> result {
367-
ret rec(mutable bcx = bcx,
368-
mutable val = val);
367+
ret rec(bcx = bcx,
368+
val = val);
369369
}
370370

371371
fn ty_str(type_names tn, TypeRef t) -> str {
@@ -2019,7 +2019,7 @@ fn emit_tydescs(&@crate_ctxt ccx) {
20192019

20202020
auto ti = pair._1;
20212021

2022-
auto take_glue = alt (ti.take_glue) {
2022+
auto take_glue = alt ({ti.take_glue}) {
20232023
case (none) {
20242024
ccx.stats.n_null_glues += 1u;
20252025
C_null(glue_fn_ty)
@@ -2030,7 +2030,7 @@ fn emit_tydescs(&@crate_ctxt ccx) {
20302030
}
20312031
};
20322032

2033-
auto drop_glue = alt (ti.drop_glue) {
2033+
auto drop_glue = alt ({ti.drop_glue}) {
20342034
case (none) {
20352035
ccx.stats.n_null_glues += 1u;
20362036
C_null(glue_fn_ty)
@@ -2041,7 +2041,7 @@ fn emit_tydescs(&@crate_ctxt ccx) {
20412041
}
20422042
};
20432043

2044-
auto free_glue = alt (ti.free_glue) {
2044+
auto free_glue = alt ({ti.free_glue}) {
20452045
case (none) {
20462046
ccx.stats.n_null_glues += 1u;
20472047
C_null(glue_fn_ty)
@@ -2052,7 +2052,7 @@ fn emit_tydescs(&@crate_ctxt ccx) {
20522052
}
20532053
};
20542054

2055-
auto cmp_glue = alt (ti.cmp_glue) {
2055+
auto cmp_glue = alt ({ti.cmp_glue}) {
20562056
case (none) {
20572057
ccx.stats.n_null_glues += 1u;
20582058
C_null(cmp_fn_ty)
@@ -2998,7 +2998,7 @@ fn lazily_emit_tydesc_glue(&@block_ctxt cx, int field,
29982998
case (some(?ti)) {
29992999

30003000
if(field == abi::tydesc_field_take_glue) {
3001-
alt (ti.take_glue) {
3001+
alt ({ti.take_glue}) {
30023002
case (some(_)) {}
30033003
case (none) {
30043004
log #fmt("+++ lazily_emit_tydesc_glue TAKE %s",
@@ -3019,7 +3019,7 @@ fn lazily_emit_tydesc_glue(&@block_ctxt cx, int field,
30193019
}
30203020
}
30213021
} else if (field == abi::tydesc_field_drop_glue) {
3022-
alt (ti.drop_glue) {
3022+
alt ({ti.drop_glue}) {
30233023
case (some(_)) { }
30243024
case (none) {
30253025
log #fmt("+++ lazily_emit_tydesc_glue DROP %s",
@@ -3039,7 +3039,7 @@ fn lazily_emit_tydesc_glue(&@block_ctxt cx, int field,
30393039
}
30403040

30413041
} else if (field == abi::tydesc_field_free_glue) {
3042-
alt (ti.free_glue) {
3042+
alt ({ti.free_glue}) {
30433043
case (some(_)) { }
30443044
case (none) {
30453045
log #fmt("+++ lazily_emit_tydesc_glue FREE %s",
@@ -3060,7 +3060,7 @@ fn lazily_emit_tydesc_glue(&@block_ctxt cx, int field,
30603060
}
30613061

30623062
} else if (field == abi::tydesc_field_cmp_glue) {
3063-
alt (ti.cmp_glue) {
3063+
alt ({ti.cmp_glue}) {
30643064
case (some(_)) { }
30653065
case (none) {
30663066
log #fmt("+++ lazily_emit_tydesc_glue CMP %s",
@@ -3931,7 +3931,7 @@ fn trans_for(&@block_ctxt cx,
39313931
fn collect_upvars(&@block_ctxt cx, &ast::block bloc,
39323932
&ast::def_id initial_decl) -> vec[ast::def_id] {
39333933
type env = @rec(
3934-
mutable vec[ast::def_id] refs,
3934+
vec[ast::def_id] refs,
39353935
hashmap[ast::def_id,()] decls,
39363936
resolve::def_map def_map
39373937
);
@@ -3965,7 +3965,7 @@ fn collect_upvars(&@block_ctxt cx, &ast::block bloc,
39653965
let vec[ast::def_id] refs = [];
39663966
let hashmap[ast::def_id,()] decls = new_def_hash[()]();
39673967
decls.insert(initial_decl, ());
3968-
let env e = @rec(mutable refs=refs,
3968+
let env e = @rec(refs=refs,
39693969
decls=decls,
39703970
def_map=cx.fcx.lcx.ccx.tcx.def_map);
39713971

@@ -4717,7 +4717,7 @@ fn trans_lval(&@block_ctxt cx, &@ast::expr e) -> lval_result {
47174717
ret lval_mem(sub.bcx, val);
47184718
}
47194719
case (ast::expr_self_method(?ident, ?ann)) {
4720-
alt (cx.fcx.llself) {
4720+
alt ({cx.fcx.llself}) {
47214721
case (some(?pair)) {
47224722
auto r = pair.v;
47234723
auto t = pair.t;
@@ -4765,12 +4765,15 @@ fn trans_cast(&@block_ctxt cx, &@ast::expr e, &ast::ann ann) -> result {
47654765
// TODO: native-to-native casts
47664766
if (ty::type_is_native(cx.fcx.lcx.ccx.tcx,
47674767
ty::expr_ty(cx.fcx.lcx.ccx.tcx, e))) {
4768-
e_res.val = e_res.bcx.build.PtrToInt(e_res.val, lldsttype);
4768+
e_res = res(e_res.bcx,
4769+
e_res.bcx.build.PtrToInt(e_res.val, lldsttype));
47694770
} else if (ty::type_is_native(cx.fcx.lcx.ccx.tcx, t)) {
4770-
e_res.val = e_res.bcx.build.IntToPtr(e_res.val, lldsttype);
4771+
e_res = res(e_res.bcx,
4772+
e_res.bcx.build.IntToPtr(e_res.val, lldsttype));
47714773
} else {
4772-
e_res.val = int_cast(e_res.bcx, lldsttype, llsrctype, e_res.val,
4773-
ty::type_is_signed(cx.fcx.lcx.ccx.tcx, t));
4774+
e_res = res(e_res.bcx,
4775+
int_cast(e_res.bcx, lldsttype, llsrctype, e_res.val,
4776+
ty::type_is_signed(cx.fcx.lcx.ccx.tcx, t)));
47744777
}
47754778
} else {
47764779
cx.fcx.lcx.ccx.sess.unimpl("fp cast");
@@ -5767,7 +5770,7 @@ fn with_out_method(fn(&out_method) -> result work, &@block_ctxt cx,
57675770
find_scope_cx(cx).cleanups += [clean(cleanup)];
57685771

57695772
auto done = work(save_in(res_alloca.val));
5770-
done.val = load_if_immediate(done.bcx, res_alloca.val, tp);
5773+
done = res(done.bcx, load_if_immediate(done.bcx, res_alloca.val, tp));
57715774
ret done;
57725775
}
57735776
}
@@ -5932,7 +5935,7 @@ fn trans_put(&@block_ctxt cx, &option::t[@ast::expr] e) -> result {
59325935
auto llcallee = C_nil();
59335936
auto llenv = C_nil();
59345937

5935-
alt (cx.fcx.lliterbody) {
5938+
alt ({cx.fcx.lliterbody}) {
59365939
case (some(?lli)) {
59375940
auto slot = alloca(cx, val_ty(lli));
59385941
cx.build.Store(lli, slot);
@@ -5971,7 +5974,7 @@ fn trans_break_cont(&@block_ctxt cx, bool to_end) -> result {
59715974
auto cleanup_cx = cx;
59725975
while (true) {
59735976
bcx = trans_block_cleanups(bcx, cleanup_cx);
5974-
alt (cleanup_cx.kind) {
5977+
alt ({cleanup_cx.kind}) {
59755978
case (LOOP_SCOPE_BLOCK(?_cont, ?_break)) {
59765979
if (to_end) {
59775980
bcx.build.Br(_break.llbb);
@@ -5989,7 +5992,7 @@ fn trans_break_cont(&@block_ctxt cx, bool to_end) -> result {
59895992
C_nil());
59905993
}
59915994
case (_) {
5992-
alt (cleanup_cx.parent) {
5995+
alt ({cleanup_cx.parent}) {
59935996
case (parent_some(?cx)) { cleanup_cx = cx; }
59945997
}
59955998
}
@@ -6033,7 +6036,7 @@ fn trans_ret(&@block_ctxt cx, &option::t[@ast::expr] e) -> result {
60336036
auto cleanup_cx = cx;
60346037
while (more_cleanups) {
60356038
bcx = trans_block_cleanups(bcx, cleanup_cx);
6036-
alt (cleanup_cx.parent) {
6039+
alt ({cleanup_cx.parent}) {
60376040
case (parent_some(?b)) {
60386041
cleanup_cx = b;
60396042
}
@@ -6831,7 +6834,7 @@ fn copy_any_self_to_alloca(@fn_ctxt fcx,
68316834

68326835
auto bcx = llallocas_block_ctxt(fcx);
68336836

6834-
alt (fcx.llself) {
6837+
alt ({fcx.llself}) {
68356838
case (some(?pair)) {
68366839
alt (ty_self) {
68376840
case (some[ty_self_pair](?tt)) {
@@ -7000,7 +7003,7 @@ fn trans_fn(@local_ctxt cx, &span sp, &ast::_fn f, ast::def_id fid,
70007003

70017004
copy_any_self_to_alloca(fcx, ty_self);
70027005

7003-
alt (fcx.llself) {
7006+
alt ({fcx.llself}) {
70047007
case (some(?llself)) {
70057008
populate_fn_ctxt_from_llself(fcx, llself);
70067009
}

trunk/src/comp/middle/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1540,7 +1540,7 @@ fn eq_ty(&t a, &t b) -> bool { ret a == b; }
15401540

15411541
fn ann_to_ty_param_substs_opt_and_ty(&node_type_table ntt, &ast::ann ann)
15421542
-> ty_param_substs_opt_and_ty {
1543-
alt (ntt.(ann.id)) {
1543+
alt ({ntt.(ann.id)}) {
15441544
case (none) {
15451545
log_err "ann_to_ty_param_substs_opt_and_ty() called on an " +
15461546
"untyped node";

trunk/src/comp/middle/typeck.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,11 +379,13 @@ fn ast_ty_to_ty_crate(@crate_ctxt ccx, &@ast::ty ast_ty) -> ty::t {
379379
mod write {
380380
fn inner(&node_type_table ntt, uint node_id,
381381
&ty_param_substs_opt_and_ty tpot) {
382+
auto ntt_ = *ntt;
382383
vec::grow_set[option::t[ty::ty_param_substs_opt_and_ty]]
383-
(*ntt,
384+
(ntt_,
384385
node_id,
385386
none[ty_param_substs_opt_and_ty],
386387
some[ty_param_substs_opt_and_ty](tpot));
388+
*ntt = ntt_;
387389
}
388390

389391
// Writes a type parameter count and type pair into the node type table.
@@ -792,7 +794,7 @@ mod collect {
792794
// type of the native item. We simply write it into the node type
793795
// table.
794796
auto tpt = ty_of_native_item(cx, i,
795-
option::get[ast::native_abi](*abi));
797+
option::get[ast::native_abi]({*abi}));
796798

797799
alt (i.node) {
798800
case (ast::native_item_ty(_,_)) {
@@ -921,7 +923,7 @@ mod unify {
921923
auto result = ty::unify::unify(expected, actual, handler, bindings,
922924
scx.fcx.ccx.tcx);
923925

924-
alt (result) {
926+
alt ({result}) {
925927
case (ures_ok(?rty)) {
926928
if (ty::type_contains_vars(scx.fcx.ccx.tcx, rty)) {
927929
result = ty::unify::fixup(scx.fcx.ccx.tcx, bindings, rty);

0 commit comments

Comments
 (0)