about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2011-03-03 14:02:29 -0800
committerPatrick Walton <pcwalton@mimiga.net>2011-03-03 14:03:37 -0800
commit5dba7a77d2c7396989262da3de5ea055bed151bc (patch)
tree54660dc043c60602abd2a35531b6652398403c8b /src
parentda8058ff836a4e9a30e36ef96449dfef576b13e4 (diff)
downloadrust-5dba7a77d2c7396989262da3de5ea055bed151bc.tar.gz
rust-5dba7a77d2c7396989262da3de5ea055bed151bc.zip
rustc: Don't call type_of() in GEP_tup_like() if there are any type parameters in the result
Diffstat (limited to 'src')
-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 7e463ae9646..9587b008dc6 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));
 }