提交 8ff77b14 编写于 作者: P Patrick Walton

rustc: Make iter_sequence() work with generic vectors

上级 9ad9d378
......@@ -2066,8 +2066,15 @@ fn adaptor_fn(val_and_ty_fn f,
@block_ctxt cx,
ValueRef dst,
ValueRef src) -> result {
auto llty = type_of(cx.fcx.ccx, elt_ty);
auto p = cx.build.PointerCast(src, T_ptr(llty));
auto llptrty;
if (!ty.type_has_dynamic_size(elt_ty)) {
auto llty = type_of(cx.fcx.ccx, elt_ty);
llptrty = T_ptr(llty);
} else {
llptrty = T_ptr(T_ptr(T_i8()));
}
auto p = cx.build.PointerCast(src, llptrty);
ret f(cx, load_scalar_or_boxed(cx, p, elt_ty), elt_ty);
}
......@@ -2094,7 +2101,13 @@ fn iter_sequence_body(@block_ctxt cx,
auto lenptr = cx.build.GEP(v, vec(C_int(0),
C_int(abi.vec_elt_fill)));
auto llunit_ty = type_of(cx.fcx.ccx, elt_ty);
auto llunit_ty;
if (ty.type_has_dynamic_size(elt_ty)) {
llunit_ty = T_i8();
} else {
llunit_ty = type_of(cx.fcx.ccx, elt_ty);
}
auto bcx = cx;
auto len = bcx.build.Load(lenptr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册