2014-11-08 01:23:33 +00:00
|
|
|
fn is_sized<T:Sized>() { }
|
2015-01-05 21:16:49 +00:00
|
|
|
fn not_sized<T: ?Sized>() { }
|
2014-11-08 01:23:33 +00:00
|
|
|
|
2013-05-31 01:40:55 +00:00
|
|
|
struct Foo<T> { data: T }
|
2014-11-08 01:23:33 +00:00
|
|
|
fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory.
|
2015-01-05 21:16:49 +00:00
|
|
|
fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
|
2018-07-10 21:10:13 +00:00
|
|
|
//~^ ERROR the size for values of type
|
2014-11-08 01:23:33 +00:00
|
|
|
//
|
|
|
|
// Not OK: `T` is not sized.
|
2013-05-31 01:40:55 +00:00
|
|
|
|
2015-01-05 21:16:49 +00:00
|
|
|
struct Bar<T: ?Sized> { data: T }
|
|
|
|
fn bar1<T: ?Sized>() { not_sized::<Bar<T>>() }
|
|
|
|
fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() }
|
2018-07-10 21:10:13 +00:00
|
|
|
//~^ ERROR the size for values of type
|
2014-11-08 01:23:33 +00:00
|
|
|
//
|
|
|
|
// Not OK: `Bar<T>` is not sized, but it should be.
|
2014-09-12 14:45:39 +00:00
|
|
|
|
2013-05-31 01:40:55 +00:00
|
|
|
fn main() { }
|