about summary refs log tree commit diff
path: root/src/test/ui/pattern/move-ref-patterns/feature-gate-move_ref_pattern.rs
blob: fb92eb1ba32e0e74be8face458034dc4804ba961 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
fn main() {
    #[derive(Clone)]
    struct X {
        x: (),
    }
    let mut tup = (X { x: () }, X { x: () });
    match Some(tup.clone()) {
        Some((y, ref z)) => {}
        //~^ ERROR binding by-move and by-ref in the same pattern is unstable
        None => panic!(),
    }

    let (ref a, b) = tup.clone();
    //~^ ERROR binding by-move and by-ref in the same pattern is unstable

    let (a, mut b) = &tup;
    //~^ ERROR binding by-move and by-ref in the same pattern is unstable
    //~| ERROR cannot move out of a shared reference

    let (mut a, b) = &mut tup;
    //~^ ERROR binding by-move and by-ref in the same pattern is unstable
    //~| ERROR cannot move out of a mutable reference
}