2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(dead_code)]
|
2018-08-31 13:02:01 +00:00
|
|
|
#![allow(non_camel_case_types)]
|
|
|
|
#![allow(non_shorthand_field_patterns)]
|
|
|
|
|
2015-02-10 21:52:00 +00:00
|
|
|
#![feature(box_patterns)]
|
2011-09-25 04:20:36 +00:00
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
struct Foo {a: isize, b: usize}
|
2013-01-26 06:46:32 +00:00
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
enum bar { u(Box<Foo>), w(isize), }
|
2011-09-23 21:58:06 +00:00
|
|
|
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2021-08-25 00:39:40 +00:00
|
|
|
let v = match bar::u(Box::new(Foo{ a: 10, b: 40 })) {
|
|
|
|
bar::u(box Foo{ a: a, b: b }) => { a + (b as isize) }
|
|
|
|
_ => { 66 }
|
|
|
|
};
|
|
|
|
assert_eq!(v, 50);
|
2011-09-23 21:58:06 +00:00
|
|
|
}
|