Skip to content

Commit 5dba7a7

Browse files
committed
rustc: Don't call type_of() in GEP_tup_like() if there are any type parameters in the result
1 parent da8058f commit 5dba7a7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/comp/middle/trans.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,13 +1049,13 @@ fn GEP_tup_like(@block_ctxt cx, @ty.t t,
10491049
bcx = sz.bcx;
10501050
auto raw = bcx.build.PointerCast(base, T_ptr(T_i8()));
10511051
auto bumped = bcx.build.GEP(raw, vec(sz.val));
1052-
alt (s.target.struct) {
1053-
case (ty.ty_param(_)) { ret res(bcx, bumped); }
1054-
case (_) {
1055-
auto ty = T_ptr(type_of(bcx.fcx.ccx, s.target));
1056-
ret res(bcx, bcx.build.PointerCast(bumped, ty));
1057-
}
1052+
1053+
if (ty.type_has_dynamic_size(s.target)) {
1054+
ret res(bcx, bumped);
10581055
}
1056+
1057+
auto typ = T_ptr(type_of(bcx.fcx.ccx, s.target));
1058+
ret res(bcx, bcx.build.PointerCast(bumped, typ));
10591059
}
10601060

10611061

0 commit comments

Comments
 (0)