2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
2015-03-22 13:13:15 -07:00
|
|
|
//@ pretty-expanded FIXME #23616
|
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
fn foo(x: Option<Box<isize>>, b: bool) -> isize {
|
2012-09-12 17:06:36 -07:00
|
|
|
match x {
|
|
|
|
None => { 1 }
|
2013-03-15 18:27:15 -04:00
|
|
|
Some(ref x) if b => { *x.clone() }
|
2012-09-12 17:06:36 -07:00
|
|
|
Some(_) => { 0 }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2021-08-25 02:39:40 +02:00
|
|
|
foo(Some(Box::new(22)), true);
|
|
|
|
foo(Some(Box::new(22)), false);
|
2012-09-12 17:06:36 -07:00
|
|
|
foo(None, true);
|
|
|
|
foo(None, false);
|
2013-02-14 11:47:00 -08:00
|
|
|
}
|