]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/pattern/bindings-after-at/box-patterns.rs
1 // Test bindings-after-at with box-patterns
5 #![feature(box_patterns)]
7 #[derive(Debug, PartialEq)]
13 fn test(x
: Option
<Box
<i32>>) -> MatchArm
{
15 ref bar @
Some(box n
) if n
> 0 => {
16 // bar is a &Option<Box<i32>>
21 Some(ref bar @
box n
) if n
< 0 => {
22 // bar is a &Box<i32> here
32 assert_eq
!(test(Some(Box
::new(2))), MatchArm
::Arm(0));
33 assert_eq
!(test(Some(Box
::new(-1))), MatchArm
::Arm(1));
34 assert_eq
!(test(Some(Box
::new(0))), MatchArm
::Wild
);