summaryrefslogtreecommitdiffstats
path: root/src/test/ui/dynamically-sized-types/dst-irrefutable-bind.rs
blob: 0a6c49111febedbb5fe80addfbcbae5d4259c625 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// run-pass
#![feature(unsized_tuple_coercion)]

struct Test<T: ?Sized>(T);

fn main() {
    let x = Test([1,2,3]);
    let x : &Test<[i32]> = &x;

    let & ref _y = x;

    // Make sure binding to a fat pointer behind a reference
    // still works
    let slice = &[1,2,3];
    let x = Test(&slice);
    let Test(&_slice) = x;


    let x = (10, [1,2,3]);
    let x : &(i32, [i32]) = &x;

    let & ref _y = x;

    let slice = &[1,2,3];
    let x = (10, &slice);
    let (_, &_slice) = x;
}