summaryrefslogtreecommitdiffstats
path: root/src/test/ui/for-loop-while/while-prelude-drop.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/for-loop-while/while-prelude-drop.rs')
-rw-r--r--src/test/ui/for-loop-while/while-prelude-drop.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/ui/for-loop-while/while-prelude-drop.rs b/src/test/ui/for-loop-while/while-prelude-drop.rs
new file mode 100644
index 000000000..196b9daf6
--- /dev/null
+++ b/src/test/ui/for-loop-while/while-prelude-drop.rs
@@ -0,0 +1,24 @@
+// run-pass
+#![allow(non_camel_case_types)]
+
+use std::string::String;
+
+#[derive(PartialEq)]
+enum t { a, b(String), }
+
+fn make(i: isize) -> t {
+ if i > 10 { return t::a; }
+ let mut s = String::from("hello");
+ // Ensure s is non-const.
+
+ s.push_str("there");
+ return t::b(s);
+}
+
+pub fn main() {
+ let mut i = 0;
+
+
+ // The auto slot for the result of make(i) should not leak.
+ while make(i) != t::a { i += 1; }
+}