diff options
Diffstat (limited to 'src/test/ui/dst/dst-bad-coerce4.rs')
-rw-r--r-- | src/test/ui/dst/dst-bad-coerce4.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/ui/dst/dst-bad-coerce4.rs b/src/test/ui/dst/dst-bad-coerce4.rs new file mode 100644 index 000000000..f63da60d2 --- /dev/null +++ b/src/test/ui/dst/dst-bad-coerce4.rs @@ -0,0 +1,25 @@ +// Attempt to coerce from unsized to sized. + +#![feature(unsized_tuple_coercion)] + +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 + //~| expected array `[isize; 3]`, found slice `[isize]` + //~| expected reference `&Fat<[isize; 3]>` + //~| found reference `&Fat<[isize]>` + + // Tuple with a vec of isizes. + let f1: &([isize],) = &([1, 2, 3],); + let f2: &([isize; 3],) = f1; + //~^ ERROR mismatched types + //~| expected array `[isize; 3]`, found slice `[isize]` + //~| expected reference `&([isize; 3],)` + //~| found reference `&([isize],)` +} |