We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2b36a8e commit 264de9cCopy full SHA for 264de9c
src/comp/middle/trans.rs
@@ -1611,7 +1611,14 @@ impure fn trans_ret(@block_ctxt cx, &option.t[@ast.expr] e) -> result {
1611
}
1612
1613
alt (e) {
1614
- case (some[@ast.expr](_)) {
+ case (some[@ast.expr](?e)) {
1615
+ if (typeck.type_is_structural(typeck.expr_ty(e))) {
1616
+ // We usually treat structurals by-pointer; in particular,
1617
+ // trans_expr will have given us a structure pointer. But in
1618
+ // this case we're about to return. LLVM wants a first-class
1619
+ // value here (which makes sense; the frame is going away!)
1620
+ r.val = r.bcx.build.Load(r.val);
1621
+ }
1622
r.val = r.bcx.build.Ret(r.val);
1623
ret r;
1624
0 commit comments