1 // Test bindings-after-at with box-patterns
5 #![feature(bindings_after_at)]
6 #![feature(box_patterns)]
8 #[derive(Debug, PartialEq)]
14 fn test(x: Option<Box<i32>>) -> MatchArm {
16 ref bar @ Some(box n) if n > 0 => {
17 // bar is a &Option<Box<i32>>
22 Some(ref bar @ box n) if n < 0 => {
23 // bar is a &Box<i32> here
33 assert_eq!(test(Some(Box::new(2))), MatchArm::Arm(0));
34 assert_eq!(test(Some(Box::new(-1))), MatchArm::Arm(1));
35 assert_eq!(test(Some(Box::new(0))), MatchArm::Wild);