aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2011-03-03 14:02:29 -0800
committerPatrick Walton <[email protected]>2011-03-03 14:03:37 -0800
commit5dba7a77d2c7396989262da3de5ea055bed151bc (patch)
tree54660dc043c60602abd2a35531b6652398403c8b
parentHandle native types in calls. (diff)
downloadrust-5dba7a77d2c7396989262da3de5ea055bed151bc.tar.xz
rust-5dba7a77d2c7396989262da3de5ea055bed151bc.zip
rustc: Don't call type_of() in GEP_tup_like() if there are any type parameters in the result
-rw-r--r--src/comp/middle/trans.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index 7e463ae9..9587b008 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -1049,13 +1049,13 @@ fn GEP_tup_like(@block_ctxt cx, @ty.t t,
bcx = sz.bcx;
auto raw = bcx.build.PointerCast(base, T_ptr(T_i8()));
auto bumped = bcx.build.GEP(raw, vec(sz.val));
- alt (s.target.struct) {
- case (ty.ty_param(_)) { ret res(bcx, bumped); }
- case (_) {
- auto ty = T_ptr(type_of(bcx.fcx.ccx, s.target));
- ret res(bcx, bcx.build.PointerCast(bumped, ty));
- }
+
+ if (ty.type_has_dynamic_size(s.target)) {
+ ret res(bcx, bumped);
}
+
+ auto typ = T_ptr(type_of(bcx.fcx.ccx, s.target));
+ ret res(bcx, bcx.build.PointerCast(bumped, typ));
}