error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized5.rs:4:9 | LL | struct S1 { | - this type parameter needs to be `std::marker::Sized` LL | f1: X, | ^ doesn't have a size known at compile-time | = note: only the last field of a struct may have a dynamically sized type = help: change the field's type to have a statically known size help: borrowed types always have a statically known size | LL | f1: &X, | ^ help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | f1: Box, | ^^^^ ^ error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized5.rs:10:8 | LL | struct S2 { | - this type parameter needs to be `std::marker::Sized` LL | f: isize, LL | g: X, | ^ doesn't have a size known at compile-time | = note: only the last field of a struct may have a dynamically sized type = help: change the field's type to have a statically known size help: borrowed types always have a statically known size | LL | g: &X, | ^ help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | g: Box, | ^^^^ ^ error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/unsized5.rs:15:8 | LL | f: str, | ^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` = note: only the last field of a struct may have a dynamically sized type = help: change the field's type to have a statically known size help: borrowed types always have a statically known size | LL | f: &str, | ^ help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | f: Box, | ^^^^ ^ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/unsized5.rs:20:8 | LL | f: [u8], | ^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` = note: only the last field of a struct may have a dynamically sized type = help: change the field's type to have a statically known size help: borrowed types always have a statically known size | LL | f: &[u8], | ^ help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | f: Box<[u8]>, | ^^^^ ^ error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized5.rs:25:8 | LL | enum E { | - this type parameter needs to be `std::marker::Sized` LL | V1(X, isize), | ^ doesn't have a size known at compile-time | = note: no field of an enum variant may have a dynamically sized type = help: change the field's type to have a statically known size help: borrowed types always have a statically known size | LL | V1(&X, isize), | ^ help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | V1(Box, isize), | ^^^^ ^ error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized5.rs:29:12 | LL | enum F { | - this type parameter needs to be `std::marker::Sized` LL | V2{f1: X, f: isize}, | ^ doesn't have a size known at compile-time | = note: no field of an enum variant may have a dynamically sized type = help: change the field's type to have a statically known size help: borrowed types always have a statically known size | LL | V2{f1: &X, f: isize}, | ^ help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | V2{f1: Box, f: isize}, | ^^^^ ^ error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0277`.