diff --git a/src/Makefile b/src/Makefile index e06bb3865b9..a407f2066be 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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 \ diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 17ec85c7621..9d6e867e904 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -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)); }