Skip to content

Commit e0985c1

Browse files
committedAug 4, 2011
Handle alt on a _|_ - typed value
Return the result of the discriminant from trans_alt, rather than nil, in the _|_ case. This was breaking the enclosed test case (alt-bot-2) when optimization was disabled. Closes #769
1 parent 5f03ca4 commit e0985c1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
 

‎src/comp/middle/trans_alt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ fn trans_alt(cx: &@block_ctxt, expr: &@ast::expr, arms: &ast::arm[],
433433
ret rslt(cx, cx.build.Unreachable());
434434
}
435435
else {
436-
ret rslt(cx, C_nil());
436+
ret er;
437437
}
438438
}
439439

‎src/test/run-pass/alt-bot-2.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// n.b. This was only ever failing with optimization disabled.
2+
fn a() -> int { alt ret 1 { 2 { 3 } } }
3+
fn main() { a(); }

0 commit comments

Comments
 (0)
Please sign in to comment.