2019-07-27 00:54:25 +03:00
|
|
|
// run-pass
|
|
|
|
|
2011-09-23 14:58:06 -07:00
|
|
|
// Tests for if as expressions returning boxed types
|
|
|
|
fn test_box() {
|
2021-08-25 02:39:40 +02:00
|
|
|
let rs: Box<_> = if true { Box::new(100) } else { Box::new(101) };
|
2015-01-25 22:05:03 +01:00
|
|
|
assert_eq!(*rs, 100);
|
2011-09-23 14:58:06 -07:00
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() { test_box(); }
|