rustc: Load structural loop variables in iterators. Un-XFAIL foreach-put-structured.rs.

This commit is contained in:
Patrick Walton 2011-03-11 14:28:49 -08:00
parent 28d51e3fd2
commit 6392bd1681
2 changed files with 10 additions and 2 deletions

View File

@ -449,7 +449,6 @@ TEST_XFAILS_RUSTC := $(addprefix test/run-pass/, \
comm.rs \
constrained-type.rs \
destructor-ordering.rs \
foreach-put-structured.rs \
iter-ret.rs \
lazychan.rs \
lib-bitv.rs \

View File

@ -4512,10 +4512,19 @@ fn trans_put(@block_ctxt cx, &option.t[@ast.expr] e) -> result {
case (none[@ast.expr]) { }
case (some[@ast.expr](?x)) {
auto r = trans_expr(bcx, x);
llargs += r.val;
auto llarg = r.val;
bcx = r.bcx;
if (ty.type_is_structural(ty.expr_ty(x))) {
// Until here we've been treating structures by pointer; we
// are now passing it as an arg, so need to load it.
llarg = bcx.build.Load(llarg);
}
llargs += llarg;
}
}
ret res(bcx, bcx.build.FastCall(llcallee, llargs));
}