Skip to content

Commit 885df31

Browse files
committed
---
yaml --- r: 4835 b: refs/heads/master c: bc998c6 h: refs/heads/master i: 4833: f5b1bce 4831: c6c9fe5 v: v3
1 parent 369fca6 commit 885df31

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: f6ae60a432d041b4387f9655dc7e8551b8cbed00
2+
refs/heads/master: bc998c6140216b7857da63175612fab1e96e90cb

trunk/src/comp/middle/trans.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5369,7 +5369,19 @@ fn trans_ret(cx: &@block_ctxt, e: &option::t<@ast::expr>) -> result {
53695369
let t = ty::expr_ty(bcx_tcx(cx), x);
53705370
let lv = trans_lval(cx, x);
53715371
bcx = lv.res.bcx;
5372-
bcx = move_val_if_temp(bcx, INIT, cx.fcx.llretptr, lv, t).bcx;
5372+
let is_local = alt x.node {
5373+
ast::expr_path(p) {
5374+
alt bcx_tcx(bcx).def_map.get(x.id) {
5375+
ast::def_local(_) { true } _ { false }
5376+
}
5377+
}
5378+
_ { false }
5379+
};
5380+
if is_local {
5381+
bcx = move_val(bcx, INIT, cx.fcx.llretptr, lv, t).bcx;
5382+
} else {
5383+
bcx = move_val_if_temp(bcx, INIT, cx.fcx.llretptr, lv, t).bcx;
5384+
}
53735385
}
53745386
_ {
53755387
let t = llvm::LLVMGetElementType(val_ty(cx.fcx.llretptr));

0 commit comments

Comments
 (0)