2015-01-06 14:03:46 +13:00
|
|
|
// Test `?Sized` local variables.
|
2014-04-24 11:57:22 +12:00
|
|
|
|
2015-04-17 22:12:20 -07:00
|
|
|
trait T {}
|
2014-04-24 11:57:22 +12:00
|
|
|
|
2017-05-08 19:45:27 +03:00
|
|
|
fn f1<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized>(x: &X) {
|
|
|
|
let _: W; // <-- this is OK, no bindings created, no initializer.
|
2018-06-09 16:53:36 -07:00
|
|
|
let _: (isize, (X, isize));
|
2018-07-10 23:10:13 +02:00
|
|
|
//~^ ERROR the size for values of type
|
2018-06-09 16:53:36 -07:00
|
|
|
let y: Y;
|
2018-07-10 23:10:13 +02:00
|
|
|
//~^ ERROR the size for values of type
|
2018-06-09 16:53:36 -07:00
|
|
|
let y: (isize, (Z, usize));
|
2018-07-10 23:10:13 +02:00
|
|
|
//~^ ERROR the size for values of type
|
2014-04-24 11:57:22 +12:00
|
|
|
}
|
2017-05-08 19:45:27 +03:00
|
|
|
fn f2<X: ?Sized, Y: ?Sized>(x: &X) {
|
2018-06-09 16:53:36 -07:00
|
|
|
let y: X;
|
2018-07-10 23:10:13 +02:00
|
|
|
//~^ ERROR the size for values of type
|
2018-06-09 16:53:36 -07:00
|
|
|
let y: (isize, (Y, isize));
|
2018-07-10 23:10:13 +02:00
|
|
|
//~^ ERROR the size for values of type
|
2014-04-24 11:57:22 +12:00
|
|
|
}
|
|
|
|
|
2015-01-06 10:16:49 +13:00
|
|
|
fn f3<X: ?Sized>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
|
2018-06-09 16:53:36 -07:00
|
|
|
let y: X = *x1;
|
2018-07-10 23:10:13 +02:00
|
|
|
//~^ ERROR the size for values of type
|
2018-06-09 16:53:36 -07:00
|
|
|
let y = *x2;
|
2018-07-10 23:10:13 +02:00
|
|
|
//~^ ERROR the size for values of type
|
2018-06-09 16:53:36 -07:00
|
|
|
let (y, z) = (*x3, 4);
|
2018-07-10 23:10:13 +02:00
|
|
|
//~^ ERROR the size for values of type
|
2014-04-24 11:57:22 +12:00
|
|
|
}
|
2015-01-07 11:33:42 +13:00
|
|
|
fn f4<X: ?Sized + T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
|
2018-06-09 16:53:36 -07:00
|
|
|
let y: X = *x1;
|
2018-07-10 23:10:13 +02:00
|
|
|
//~^ ERROR the size for values of type
|
2018-06-09 16:53:36 -07:00
|
|
|
let y = *x2;
|
2018-07-10 23:10:13 +02:00
|
|
|
//~^ ERROR the size for values of type
|
2018-06-09 16:53:36 -07:00
|
|
|
let (y, z) = (*x3, 4);
|
2018-07-10 23:10:13 +02:00
|
|
|
//~^ ERROR the size for values of type
|
2014-04-24 11:57:22 +12:00
|
|
|
}
|
|
|
|
|
2018-06-09 16:53:36 -07:00
|
|
|
fn g1<X: ?Sized>(x: X) {}
|
2018-07-10 23:10:13 +02:00
|
|
|
//~^ ERROR the size for values of type
|
2018-06-09 16:53:36 -07:00
|
|
|
fn g2<X: ?Sized + T>(x: X) {}
|
2018-07-10 23:10:13 +02:00
|
|
|
//~^ ERROR the size for values of type
|
2014-04-24 11:57:22 +12:00
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
}
|