]> git.lizzy.rs Git - rust.git/blob - src/test/ui/for-loop-while/while-prelude-drop.rs
Auto merge of #99028 - tmiasko:inline, r=estebank
[rust.git] / src / test / ui / for-loop-while / while-prelude-drop.rs
1 // run-pass
2 #![allow(non_camel_case_types)]
3
4 use std::string::String;
5
6 #[derive(PartialEq)]
7 enum t { a, b(String), }
8
9 fn make(i: isize) -> t {
10     if i > 10 { return t::a; }
11     let mut s = String::from("hello");
12     // Ensure s is non-const.
13
14     s.push_str("there");
15     return t::b(s);
16 }
17
18 pub fn main() {
19     let mut i = 0;
20
21
22     // The auto slot for the result of make(i) should not leak.
23     while make(i) != t::a { i += 1; }
24 }