Skip to content

Commit 54d42c4

Browse files
committed
rustc: Make trans handle self-describing strings
1 parent a4ba088 commit 54d42c4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/rustc/middle/trans/base.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3890,9 +3890,11 @@ fn trans_fail_expr(bcx: block, sp_opt: option<span>,
38903890
bcx = expr_res.bcx;
38913891

38923892
if ty::type_is_str(e_ty) {
3893-
let data = tvec::get_dataptr(
3894-
bcx, expr_res.val, type_of(
3895-
ccx, ty::mk_mach_uint(tcx, ast::ty_u8)));
3893+
let unit_ty = ty::mk_mach_uint(tcx, ast::ty_u8);
3894+
let vec_ty = ty::mk_vec(tcx, {ty: unit_ty, mutbl: ast::m_imm});
3895+
let unit_llty = type_of(ccx, unit_ty);
3896+
let body = tvec::get_bodyptr(bcx, expr_res.val, vec_ty);
3897+
let data = tvec::get_dataptr(bcx, body, unit_llty);
38963898
ret trans_fail_value(bcx, sp_opt, data);
38973899
} else if bcx.unreachable || ty::type_is_bot(e_ty) {
38983900
ret bcx;

0 commit comments

Comments
 (0)