1 error[E0277]: the size for values of type `T` cannot be known at compilation time
2 --> $DIR/unsized-struct.rs:6:36
4 LL | fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
5 | - ^^^^^^ doesn't have a size known at compile-time
7 | this type parameter needs to be `std::marker::Sized`
9 note: required by a bound in `Foo`
10 --> $DIR/unsized-struct.rs:4:12
12 LL | struct Foo<T> { data: T }
13 | ^ required by this bound in `Foo`
14 help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>`
15 --> $DIR/unsized-struct.rs:4:12
17 LL | struct Foo<T> { data: T }
18 | ^ - ...if indirection were used here: `Box<T>`
20 | this could be changed to `T: ?Sized`...
21 help: consider removing the `?Sized` bound to make the type parameter `Sized`
23 LL - fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
24 LL + fn foo2<T>() { not_sized::<Foo<T>>() }
27 error[E0277]: the size for values of type `T` cannot be known at compilation time
28 --> $DIR/unsized-struct.rs:13:35
30 LL | fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() }
31 | - ^^^^^^ doesn't have a size known at compile-time
33 | this type parameter needs to be `std::marker::Sized`
35 note: required because it appears within the type `Bar<T>`
36 --> $DIR/unsized-struct.rs:11:8
38 LL | struct Bar<T: ?Sized> { data: T }
40 note: required by a bound in `is_sized`
41 --> $DIR/unsized-struct.rs:1:13
43 LL | fn is_sized<T:Sized>() { }
44 | ^ required by this bound in `is_sized`
45 help: consider removing the `?Sized` bound to make the type parameter `Sized`
47 LL - fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() }
48 LL + fn bar2<T>() { is_sized::<Bar<T>>() }
51 error: aborting due to 2 previous errors
53 For more information about this error, try `rustc --explain E0277`.