rustc: Unbreak old-style boxed traits

This commit is contained in:
Patrick Walton 2012-10-03 17:18:24 -07:00
parent b34327be0d
commit f885205b1b
2 changed files with 4 additions and 5 deletions

View File

@ -2348,7 +2348,7 @@ fn trap(bcx: block) {
fn push_rtcall(ccx: @crate_ctxt, name: ~str, did: ast::def_id) {
if ccx.rtcalls.contains_key(name) {
fail fmt!("multiple definitions for runtime call %s", name);
ccx.sess.bug(fmt!("multiple definitions for runtime call %s", name));
}
ccx.rtcalls.insert(name, did);
}

View File

@ -550,9 +550,6 @@ fn trans_trait_cast(bcx: block,
let v_ty = expr_ty(bcx, val);
let mut llboxdest = GEPi(bcx, lldest, [0u, 1u]);
llboxdest = PointerCast(bcx, llboxdest,
T_ptr(type_of::type_of(bcx.ccx(), v_ty)));
if bcx.tcx().legacy_boxed_traits.contains_key(id) {
// Allocate an @ box and store the value into it
let {bcx: new_bcx, box: llbox, body: body} = malloc_boxed(bcx, v_ty);
@ -562,9 +559,11 @@ fn trans_trait_cast(bcx: block,
revoke_clean(bcx, llbox);
// Store the @ box into the pair
Store(bcx, llbox, llboxdest);
Store(bcx, llbox, PointerCast(bcx, llboxdest, T_ptr(val_ty(llbox))));
} else {
// Just store the @ box into the pair.
llboxdest = PointerCast(bcx, llboxdest,
T_ptr(type_of::type_of(bcx.ccx(), v_ty)));
bcx = expr::trans_into(bcx, val, SaveIn(llboxdest));
}