2024-02-16 20:02:50 +00:00
|
|
|
//@ run-pass
|
2018-08-31 13:02:01 +00:00
|
|
|
#![allow(non_camel_case_types)]
|
2014-12-31 04:32:49 +00:00
|
|
|
#[derive(PartialEq)]
|
2014-05-22 23:57:53 +00:00
|
|
|
enum t { a, b(String), }
|
2010-11-19 22:59:58 +00:00
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
fn make(i: isize) -> t {
|
2014-11-06 08:05:53 +00:00
|
|
|
if i > 10 { return t::a; }
|
2015-06-08 14:55:35 +00:00
|
|
|
let mut s = String::from("hello");
|
2011-06-15 18:19:50 +00:00
|
|
|
// Ensure s is non-const.
|
|
|
|
|
2013-06-12 02:13:42 +00:00
|
|
|
s.push_str("there");
|
2014-11-06 08:05:53 +00:00
|
|
|
return t::b(s);
|
2010-11-19 22:59:58 +00:00
|
|
|
}
|
|
|
|
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2012-03-22 15:39:41 +00:00
|
|
|
let mut i = 0;
|
2011-07-27 12:19:39 +00:00
|
|
|
|
2011-06-15 18:19:50 +00:00
|
|
|
|
|
|
|
// The auto slot for the result of make(i) should not leak.
|
2014-11-06 08:05:53 +00:00
|
|
|
while make(i) != t::a { i += 1; }
|
2011-08-19 22:16:48 +00:00
|
|
|
}
|