summaryrefslogtreecommitdiffstats
path: root/src/test/ui/binding/match-implicit-copy-unique.rs
blob: 74ffe2ecdb3a5eea1ac94afaac0a0e4a13eaa1d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// run-pass
#![allow(non_shorthand_field_patterns)]

struct Pair { a: Box<isize>, b: Box<isize> }

pub fn main() {
    let mut x: Box<_> = Box::new(Pair { a: Box::new(10), b: Box::new(20) });
    let x_internal = &mut *x;
    match *x_internal {
      Pair {a: ref mut a, b: ref mut _b} => {
        assert_eq!(**a, 10);
        *a = Box::new(30);
        assert_eq!(**a, 30);
      }
    }
}