about summary refs log tree commit diff
path: root/tests/ui/dst/dst-bad-coerce4.rs
blob: b5288d5d3e1f450dc4f461fea92b12b620a44140 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Attempt to coerce from unsized to sized.

struct Fat<T: ?Sized> {
    ptr: T
}

pub fn main() {
    // With a vec of isizes.
    let f1: &Fat<[isize]> = &Fat { ptr: [1, 2, 3] };
    let f2: &Fat<[isize; 3]> = f1;
    //~^ ERROR mismatched types
    //~| NOTE expected `&Fat<[isize; 3]>`, found `&Fat<[isize]>`
    //~| NOTE expected reference `&Fat<[isize; 3]>`
    //~| NOTE found reference `&Fat<[isize]>`
    //~| NOTE expected due to this
}