From dfb806b367ea87df6670568590b30aca84facd80 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 17 Jun 2011 12:23:04 -0700 Subject: [PATCH] rustc: Cast to opaque interior vector types in trans_vec_append if necessary. Puts out burning tinderbox. --- src/comp/middle/trans.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 6c824d9626f..f3c071fec1c 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -3433,8 +3433,19 @@ mod ivec { stack_no_spill_cx.llbb, stack_spill_cx.llbb]); ret res(next_cx, data_ptr); } - fn trans_append(&@block_ctxt cx, &ty::t t, ValueRef lhs, ValueRef rhs) -> - result { + fn trans_append(&@block_ctxt cx, &ty::t t, ValueRef orig_lhs, + ValueRef orig_rhs) -> result { + // Cast to opaque interior vector types if necessary. + auto lhs; + auto rhs; + if (ty::type_has_dynamic_size(cx.fcx.lcx.ccx.tcx, t)) { + lhs = cx.build.PointerCast(orig_lhs, T_ptr(T_opaque_ivec())); + rhs = cx.build.PointerCast(orig_rhs, T_ptr(T_opaque_ivec())); + } else { + lhs = orig_lhs; + rhs = orig_rhs; + } + auto unit_ty = ty::sequence_element_type(cx.fcx.lcx.ccx.tcx, t); auto llunitty = type_of_or_i8(cx, unit_ty); auto skip_null;