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
This commit is contained in:
parent
5f03ca48d8
commit
e0985c1060
@ -433,7 +433,7 @@ fn trans_alt(cx: &@block_ctxt, expr: &@ast::expr, arms: &ast::arm[],
|
||||
ret rslt(cx, cx.build.Unreachable());
|
||||
}
|
||||
else {
|
||||
ret rslt(cx, C_nil());
|
||||
ret er;
|
||||
}
|
||||
}
|
||||
|
||||
|
3
src/test/run-pass/alt-bot-2.rs
Normal file
3
src/test/run-pass/alt-bot-2.rs
Normal file
@ -0,0 +1,3 @@
|
||||
// n.b. This was only ever failing with optimization disabled.
|
||||
fn a() -> int { alt ret 1 { 2 { 3 } } }
|
||||
fn main() { a(); }
|
Loading…
x
Reference in New Issue
Block a user