rustc: Don't call type_of() in GEP_tup_like() if there are any type parameters in the result

This commit is contained in:
Patrick Walton 2011-03-03 14:02:29 -08:00
parent da8058ff83
commit 5dba7a77d2

View file

@ -1049,13 +1049,13 @@ fn GEP_tup_like(@block_ctxt cx, @ty.t t,
bcx = sz.bcx; bcx = sz.bcx;
auto raw = bcx.build.PointerCast(base, T_ptr(T_i8())); auto raw = bcx.build.PointerCast(base, T_ptr(T_i8()));
auto bumped = bcx.build.GEP(raw, vec(sz.val)); auto bumped = bcx.build.GEP(raw, vec(sz.val));
alt (s.target.struct) {
case (ty.ty_param(_)) { ret res(bcx, bumped); } if (ty.type_has_dynamic_size(s.target)) {
case (_) { ret res(bcx, bumped);
auto ty = T_ptr(type_of(bcx.fcx.ccx, s.target));
ret res(bcx, bcx.build.PointerCast(bumped, ty));
}
} }
auto typ = T_ptr(type_of(bcx.fcx.ccx, s.target));
ret res(bcx, bcx.build.PointerCast(bumped, typ));
} }