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