rust/src/test/compile-fail/issue-897-2.rs
Tim Chevalier e36df0f6c8 Handle fail after return correctly in typestate
Previously, typestate would conclude that this function was
correctly diverging:

fn f() -> ! { ret; fail; }

even though it always returns to the caller. It wasn't handling the
i_diverge and i_return bits correctly in the fail case. Fixed it.

Closes #897
2012-01-20 17:26:31 -08:00

5 lines
142 B
Rust

// error-pattern: In non-returning function f, some control paths may return
fn g() -> ! { fail; }
fn f() -> ! { ret 42; g(); }
fn main() { }