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`
15 help: borrowed types always have a statically known size
19 help: the `Box` type always has a statically known size and allocates its contents in the heap
24 error[E0277]: the size for values of type `T` cannot be known at compilation time
25 --> $DIR/union-sized-field.rs:9:12
27 LL | struct Foo2<T: ?Sized> {
28 | - this type parameter needs to be `std::marker::Sized`
30 | ^ doesn't have a size known at compile-time
32 = note: only the last field of a struct may have a dynamically sized type
33 = help: change the field's type to have a statically known size
34 help: consider removing the `?Sized` bound to make the type parameter `Sized`
38 help: borrowed types always have a statically known size
42 help: the `Box` type always has a statically known size and allocates its contents in the heap
47 error[E0277]: the size for values of type `T` cannot be known at compilation time
48 --> $DIR/union-sized-field.rs:15:11
50 LL | enum Foo3<T: ?Sized> {
51 | - this type parameter needs to be `std::marker::Sized`
53 | ^ doesn't have a size known at compile-time
55 = note: no field of an enum variant may have a dynamically sized type
56 = help: change the field's type to have a statically known size
57 help: consider removing the `?Sized` bound to make the type parameter `Sized`
61 help: borrowed types always have a statically known size
65 help: the `Box` type always has a statically known size and allocates its contents in the heap
70 error: aborting due to 3 previous errors
72 For more information about this error, try `rustc --explain E0277`.