Skip to content

Commit e6b6d1b

Browse files
committed
rustc: Make trans_path() generic-safe wrt nullary tags
1 parent 95dc89f commit e6b6d1b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/comp/middle/trans.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3441,8 +3441,15 @@ fn trans_path(@block_ctxt cx, &ast.path p, &option.t[ast.def] dopt,
34413441

34423442
auto alloc_result = alloc_ty(cx, tag_ty);
34433443
auto lltagblob = alloc_result.val;
3444+
3445+
auto lltagty;
3446+
if (ty.type_has_dynamic_size(tag_ty)) {
3447+
lltagty = T_opaque_tag(cx.fcx.ccx.tn);
3448+
} else {
3449+
lltagty = type_of(cx.fcx.ccx, tag_ty);
3450+
}
34443451
auto lltagptr = alloc_result.bcx.build.PointerCast(
3445-
lltagblob, T_ptr(type_of(cx.fcx.ccx, tag_ty)));
3452+
lltagblob, T_ptr(lltagty));
34463453

34473454
auto lldiscrimptr = alloc_result.bcx.build.GEP(
34483455
lltagptr, vec(C_int(0), C_int(0)));

0 commit comments

Comments
 (0)