diff options
| author | Patrick Walton <[email protected]> | 2011-03-11 14:28:49 -0800 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-03-11 14:29:45 -0800 |
| commit | 6392bd16811f20b71693df62909c465203d4f8d7 (patch) | |
| tree | 5ee4bbc99508e8ed6fe436bfb399b8496b612e15 /src/comp | |
| parent | Add support for indexing tags in blocks. (diff) | |
| download | rust-6392bd16811f20b71693df62909c465203d4f8d7.tar.xz rust-6392bd16811f20b71693df62909c465203d4f8d7.zip | |
rustc: Load structural loop variables in iterators. Un-XFAIL foreach-put-structured.rs.
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/middle/trans.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 17ec85c7..9d6e867e 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)); } |