Skip to content

Commit f885205

Browse files
committed
rustc: Unbreak old-style boxed traits
1 parent b34327b commit f885205

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/rustc/middle/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2348,7 +2348,7 @@ fn trap(bcx: block) {
23482348

23492349
fn push_rtcall(ccx: @crate_ctxt, name: ~str, did: ast::def_id) {
23502350
if ccx.rtcalls.contains_key(name) {
2351-
fail fmt!("multiple definitions for runtime call %s", name);
2351+
ccx.sess.bug(fmt!("multiple definitions for runtime call %s", name));
23522352
}
23532353
ccx.rtcalls.insert(name, did);
23542354
}

src/rustc/middle/trans/meth.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,6 @@ fn trans_trait_cast(bcx: block,
550550
let v_ty = expr_ty(bcx, val);
551551

552552
let mut llboxdest = GEPi(bcx, lldest, [0u, 1u]);
553-
llboxdest = PointerCast(bcx, llboxdest,
554-
T_ptr(type_of::type_of(bcx.ccx(), v_ty)));
555-
556553
if bcx.tcx().legacy_boxed_traits.contains_key(id) {
557554
// Allocate an @ box and store the value into it
558555
let {bcx: new_bcx, box: llbox, body: body} = malloc_boxed(bcx, v_ty);
@@ -562,9 +559,11 @@ fn trans_trait_cast(bcx: block,
562559
revoke_clean(bcx, llbox);
563560

564561
// Store the @ box into the pair
565-
Store(bcx, llbox, llboxdest);
562+
Store(bcx, llbox, PointerCast(bcx, llboxdest, T_ptr(val_ty(llbox))));
566563
} else {
567564
// Just store the @ box into the pair.
565+
llboxdest = PointerCast(bcx, llboxdest,
566+
T_ptr(type_of::type_of(bcx.ccx(), v_ty)));
568567
bcx = expr::trans_into(bcx, val, SaveIn(llboxdest));
569568
}
570569

0 commit comments

Comments
 (0)