1 error[E0277]: the size for values of type `T` cannot be known at compilation time
2 --> $DIR/union-sized-field.rs:4:12
4 LL | union Foo<T: ?Sized> {
5 | - this type parameter needs to be `std::marker::Sized`
7 | ^ doesn't have a size known at compile-time
9 = note: no field of a union may have a dynamically sized type
10 = help: change the field's type to have a statically known size
11 help: consider removing the `?Sized` bound to make the type parameter `Sized`
13 LL - union Foo<T: ?Sized> {
16 help: borrowed types always have a statically known size
20 help: the `Box` type always has a statically known size and allocates its contents in the heap
25 error[E0277]: the size for values of type `T` cannot be known at compilation time
26 --> $DIR/union-sized-field.rs:9:12
28 LL | struct Foo2<T: ?Sized> {
29 | - this type parameter needs to be `std::marker::Sized`
31 | ^ doesn't have a size known at compile-time
33 = note: only the last field of a struct may have a dynamically sized type
34 = help: change the field's type to have a statically known size
35 help: consider removing the `?Sized` bound to make the type parameter `Sized`
37 LL - struct Foo2<T: ?Sized> {
40 help: borrowed types always have a statically known size
44 help: the `Box` type always has a statically known size and allocates its contents in the heap
49 error[E0277]: the size for values of type `T` cannot be known at compilation time
50 --> $DIR/union-sized-field.rs:15:11
52 LL | enum Foo3<T: ?Sized> {
53 | - this type parameter needs to be `std::marker::Sized`
55 | ^ doesn't have a size known at compile-time
57 = note: no field of an enum variant may have a dynamically sized type
58 = help: change the field's type to have a statically known size
59 help: consider removing the `?Sized` bound to make the type parameter `Sized`
61 LL - enum Foo3<T: ?Sized> {
64 help: borrowed types always have a statically known size
68 help: the `Box` type always has a statically known size and allocates its contents in the heap
73 error: aborting due to 3 previous errors
75 For more information about this error, try `rustc --explain E0277`.