PageRenderTime 9ms CodeModel.GetById 2ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/src/test/run-pass/while-prelude-drop.rs

http://github.com/jruderman/rust
Rust | 19 lines | 11 code | 6 blank | 2 comment | 3 complexity | 2ec021ece9023b7cad188bf10857715b MD5 | raw file
 1
 2enum t { a, b(~str), }
 3
 4fn make(i: int) -> t {
 5    if i > 10 { return a; }
 6    let mut s = ~"hello";
 7    // Ensure s is non-const.
 8
 9    s += ~"there";
10    return b(s);
11}
12
13fn main() {
14    let mut i = 0;
15
16
17    // The auto slot for the result of make(i) should not leak.
18    while make(i) != a { i += 1; }
19}