Skip to content

Commit 073f90c

Browse files
committed
introduce some copies so we are not alting into mut state
1 parent 9aa18c2 commit 073f90c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/rustc/middle/trans/base.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -539,22 +539,22 @@ fn emit_tydescs(ccx: @crate_ctxt) {
539539
let glue_fn_ty = T_ptr(T_glue_fn(ccx));
540540
let ti = val;
541541
let take_glue =
542-
alt ti.take_glue {
542+
alt copy ti.take_glue {
543543
none { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) }
544544
some(v) { ccx.stats.n_real_glues += 1u; v }
545545
};
546546
let drop_glue =
547-
alt ti.drop_glue {
547+
alt copy ti.drop_glue {
548548
none { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) }
549549
some(v) { ccx.stats.n_real_glues += 1u; v }
550550
};
551551
let free_glue =
552-
alt ti.free_glue {
552+
alt copy ti.free_glue {
553553
none { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) }
554554
some(v) { ccx.stats.n_real_glues += 1u; v }
555555
};
556556
let visit_glue =
557-
alt ti.visit_glue {
557+
alt copy ti.visit_glue {
558558
none { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) }
559559
some(v) { ccx.stats.n_real_glues += 1u; v }
560560
};
@@ -2308,7 +2308,7 @@ fn trans_local_var(cx: block, def: ast::def) -> local_var_result {
23082308
ret take_local(cx.fcx.lllocals, nid);
23092309
}
23102310
ast::def_self(_) {
2311-
let slf = alt cx.fcx.llself {
2311+
let slf = alt copy cx.fcx.llself {
23122312
some(s) { s }
23132313
none { cx.sess().bug("trans_local_var: reference to self \
23142314
out of context"); }
@@ -3030,7 +3030,7 @@ fn trans_call_inner(
30303030
Unreachable(bcx);
30313031
} else if ret_in_loop {
30323032
bcx = with_cond(bcx, Load(bcx, option::get(ret_flag))) {|bcx|
3033-
option::iter(bcx.fcx.loop_ret) {|lret|
3033+
option::iter(copy bcx.fcx.loop_ret) {|lret|
30343034
Store(bcx, C_bool(true), lret.flagptr);
30353035
Store(bcx, C_bool(false), bcx.fcx.llretptr);
30363036
}
@@ -3119,7 +3119,7 @@ fn get_landing_pad(bcx: block) -> BasicBlockRef {
31193119
let mut cached = none, pad_bcx = bcx; // Guaranteed to be set below
31203120
in_lpad_scope_cx(bcx) {|inf|
31213121
// If there is a valid landing pad still around, use it
3122-
alt inf.landing_pad {
3122+
alt copy inf.landing_pad {
31233123
some(target) { cached = some(target); }
31243124
none {
31253125
pad_bcx = sub_block(bcx, "unwind");
@@ -3148,7 +3148,7 @@ fn get_landing_pad(bcx: block) -> BasicBlockRef {
31483148

31493149
// We store the retval in a function-central alloca, so that calls to
31503150
// Resume can find it.
3151-
alt bcx.fcx.personality {
3151+
alt copy bcx.fcx.personality {
31523152
some(addr) { Store(pad_bcx, llretval, addr); }
31533153
none {
31543154
let addr = alloca(pad_bcx, val_ty(llretval));
@@ -3831,7 +3831,7 @@ fn trans_cont(cx: block) -> block {
38313831
fn trans_ret(bcx: block, e: option<@ast::expr>) -> block {
38323832
let _icx = bcx.insn_ctxt("trans_ret");
38333833
let mut bcx = bcx;
3834-
let retptr = alt bcx.fcx.loop_ret {
3834+
let retptr = alt copy bcx.fcx.loop_ret {
38353835
some({flagptr, retptr}) {
38363836
// This is a loop body return. Must set continue flag (our retptr)
38373837
// to false, return flag to true, and then store the value in the

src/rustc/middle/trans/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ fn ty_str(tn: type_names, t: TypeRef) -> str {
388388
ret lib::llvm::type_to_str(tn, t);
389389
}
390390

391-
fn val_ty(&&v: ValueRef) -> TypeRef { ret llvm::LLVMTypeOf(v); }
391+
fn val_ty(v: ValueRef) -> TypeRef { ret llvm::LLVMTypeOf(v); }
392392

393393
fn val_str(tn: type_names, v: ValueRef) -> str { ret ty_str(tn, val_ty(v)); }
394394

0 commit comments

Comments
 (0)