/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
- enum t { a, b(~str), }
- fn make(i: int) -> t {
- if i > 10 { return a; }
- let mut s = ~"hello";
- // Ensure s is non-const.
- s += ~"there";
- return b(s);
- }
- fn main() {
- let mut i = 0;
- // The auto slot for the result of make(i) should not leak.
- while make(i) != a { i += 1; }
- }