]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // Test `?Sized` local variables. |
2 | ||
9346a6ac | 3 | trait T {} |
1a4d82fc | 4 | |
041b39d2 XL |
5 | fn f1<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized>(x: &X) { |
6 | let _: W; // <-- this is OK, no bindings created, no initializer. | |
8faf50e0 XL |
7 | let _: (isize, (X, isize)); |
8 | //~^ ERROR the size for values of type | |
9 | let y: Y; | |
10 | //~^ ERROR the size for values of type | |
11 | let y: (isize, (Z, usize)); | |
12 | //~^ ERROR the size for values of type | |
1a4d82fc | 13 | } |
041b39d2 | 14 | fn f2<X: ?Sized, Y: ?Sized>(x: &X) { |
8faf50e0 XL |
15 | let y: X; |
16 | //~^ ERROR the size for values of type | |
17 | let y: (isize, (Y, isize)); | |
18 | //~^ ERROR the size for values of type | |
1a4d82fc JJ |
19 | } |
20 | ||
21 | fn f3<X: ?Sized>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { | |
8faf50e0 XL |
22 | let y: X = *x1; |
23 | //~^ ERROR the size for values of type | |
24 | let y = *x2; | |
25 | //~^ ERROR the size for values of type | |
26 | let (y, z) = (*x3, 4); | |
27 | //~^ ERROR the size for values of type | |
1a4d82fc JJ |
28 | } |
29 | fn f4<X: ?Sized + T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { | |
8faf50e0 XL |
30 | let y: X = *x1; |
31 | //~^ ERROR the size for values of type | |
32 | let y = *x2; | |
33 | //~^ ERROR the size for values of type | |
34 | let (y, z) = (*x3, 4); | |
35 | //~^ ERROR the size for values of type | |
1a4d82fc JJ |
36 | } |
37 | ||
8faf50e0 XL |
38 | fn g1<X: ?Sized>(x: X) {} |
39 | //~^ ERROR the size for values of type | |
40 | fn g2<X: ?Sized + T>(x: X) {} | |
41 | //~^ ERROR the size for values of type | |
1a4d82fc JJ |
42 | |
43 | pub fn main() { | |
44 | } |