2018-08-08 12:28:26 +00:00
|
|
|
error[E0277]: the size for values of type `X` cannot be known at compilation time
|
2020-07-10 22:13:49 +00:00
|
|
|
--> $DIR/unsized5.rs:4:9
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2019-10-08 18:03:35 +00:00
|
|
|
LL | struct S1<X: ?Sized> {
|
2023-06-14 17:22:03 +00:00
|
|
|
| - this type parameter needs to be `Sized`
|
2018-08-08 12:28:26 +00:00
|
|
|
LL | f1: X,
|
2020-07-10 22:13:49 +00:00
|
|
|
| ^ doesn't have a size known at compile-time
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
|
= note: only the last field of a struct may have a dynamically sized type
|
2020-07-10 22:13:49 +00:00
|
|
|
= help: change the field's type to have a statically known size
|
2021-07-24 01:47:53 +00:00
|
|
|
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
|
|
|
|
|
2021-06-22 02:07:19 +00:00
|
|
|
LL - struct S1<X: ?Sized> {
|
|
|
|
LL + struct S1<X> {
|
2022-06-08 17:34:57 +00:00
|
|
|
|
|
2020-07-10 22:13:49 +00:00
|
|
|
help: borrowed types always have a statically known size
|
|
|
|
|
|
|
|
|
LL | f1: &X,
|
2021-06-22 02:07:19 +00:00
|
|
|
| +
|
2020-07-14 19:18:01 +00:00
|
|
|
help: the `Box` type always has a statically known size and allocates its contents in the heap
|
2020-07-10 22:13:49 +00:00
|
|
|
|
|
|
|
|
LL | f1: Box<X>,
|
2021-06-22 02:07:19 +00:00
|
|
|
| ++++ +
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
error[E0277]: the size for values of type `X` cannot be known at compilation time
|
2020-07-10 22:13:49 +00:00
|
|
|
--> $DIR/unsized5.rs:10:8
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2019-10-08 18:03:35 +00:00
|
|
|
LL | struct S2<X: ?Sized> {
|
2023-06-14 17:22:03 +00:00
|
|
|
| - this type parameter needs to be `Sized`
|
2019-10-08 18:03:35 +00:00
|
|
|
LL | f: isize,
|
2018-08-08 12:28:26 +00:00
|
|
|
LL | g: X,
|
2020-07-10 22:13:49 +00:00
|
|
|
| ^ doesn't have a size known at compile-time
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
|
= note: only the last field of a struct may have a dynamically sized type
|
2020-07-10 22:13:49 +00:00
|
|
|
= help: change the field's type to have a statically known size
|
2021-07-24 01:47:53 +00:00
|
|
|
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
|
|
|
|
|
2021-06-22 02:07:19 +00:00
|
|
|
LL - struct S2<X: ?Sized> {
|
|
|
|
LL + struct S2<X> {
|
2022-06-08 17:34:57 +00:00
|
|
|
|
|
2020-07-10 22:13:49 +00:00
|
|
|
help: borrowed types always have a statically known size
|
|
|
|
|
|
|
|
|
LL | g: &X,
|
2021-06-22 02:07:19 +00:00
|
|
|
| +
|
2020-07-14 19:18:01 +00:00
|
|
|
help: the `Box` type always has a statically known size and allocates its contents in the heap
|
2020-07-10 22:13:49 +00:00
|
|
|
|
|
|
|
|
LL | g: Box<X>,
|
2021-06-22 02:07:19 +00:00
|
|
|
| ++++ +
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
error[E0277]: the size for values of type `str` cannot be known at compilation time
|
2020-07-10 22:13:49 +00:00
|
|
|
--> $DIR/unsized5.rs:15:8
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
|
LL | f: str,
|
2020-07-10 22:13:49 +00:00
|
|
|
| ^^^ doesn't have a size known at compile-time
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2020-09-02 07:40:56 +00:00
|
|
|
= help: the trait `Sized` is not implemented for `str`
|
2018-08-08 12:28:26 +00:00
|
|
|
= note: only the last field of a struct may have a dynamically sized type
|
2020-07-10 22:13:49 +00:00
|
|
|
= help: change the field's type to have a statically known size
|
|
|
|
help: borrowed types always have a statically known size
|
|
|
|
|
|
|
|
|
LL | f: &str,
|
2021-06-22 02:07:19 +00:00
|
|
|
| +
|
2020-07-14 19:18:01 +00:00
|
|
|
help: the `Box` type always has a statically known size and allocates its contents in the heap
|
2020-07-10 22:13:49 +00:00
|
|
|
|
|
|
|
|
LL | f: Box<str>,
|
2021-06-22 02:07:19 +00:00
|
|
|
| ++++ +
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
2020-07-10 22:13:49 +00:00
|
|
|
--> $DIR/unsized5.rs:20:8
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
|
LL | f: [u8],
|
2020-07-10 22:13:49 +00:00
|
|
|
| ^^^^ doesn't have a size known at compile-time
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2020-09-02 07:40:56 +00:00
|
|
|
= help: the trait `Sized` is not implemented for `[u8]`
|
2018-08-08 12:28:26 +00:00
|
|
|
= note: only the last field of a struct may have a dynamically sized type
|
2020-07-10 22:13:49 +00:00
|
|
|
= help: change the field's type to have a statically known size
|
|
|
|
help: borrowed types always have a statically known size
|
|
|
|
|
|
|
|
|
LL | f: &[u8],
|
2021-06-22 02:07:19 +00:00
|
|
|
| +
|
2020-07-14 19:18:01 +00:00
|
|
|
help: the `Box` type always has a statically known size and allocates its contents in the heap
|
2020-07-10 22:13:49 +00:00
|
|
|
|
|
|
|
|
LL | f: Box<[u8]>,
|
2021-06-22 02:07:19 +00:00
|
|
|
| ++++ +
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
error[E0277]: the size for values of type `X` cannot be known at compilation time
|
2018-12-25 15:56:47 +00:00
|
|
|
--> $DIR/unsized5.rs:25:8
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2019-10-08 18:03:35 +00:00
|
|
|
LL | enum E<X: ?Sized> {
|
2023-06-14 17:22:03 +00:00
|
|
|
| - this type parameter needs to be `Sized`
|
2018-08-08 12:28:26 +00:00
|
|
|
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
|
2020-07-10 22:13:49 +00:00
|
|
|
= help: change the field's type to have a statically known size
|
2021-07-24 01:47:53 +00:00
|
|
|
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
|
|
|
|
|
2021-06-22 02:07:19 +00:00
|
|
|
LL - enum E<X: ?Sized> {
|
|
|
|
LL + enum E<X> {
|
2022-06-08 17:34:57 +00:00
|
|
|
|
|
2020-07-10 22:13:49 +00:00
|
|
|
help: borrowed types always have a statically known size
|
|
|
|
|
|
|
|
|
LL | V1(&X, isize),
|
2021-06-22 02:07:19 +00:00
|
|
|
| +
|
2020-07-14 19:18:01 +00:00
|
|
|
help: the `Box` type always has a statically known size and allocates its contents in the heap
|
2020-07-10 22:13:49 +00:00
|
|
|
|
|
|
|
|
LL | V1(Box<X>, isize),
|
2021-06-22 02:07:19 +00:00
|
|
|
| ++++ +
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
error[E0277]: the size for values of type `X` cannot be known at compilation time
|
2020-07-10 22:13:49 +00:00
|
|
|
--> $DIR/unsized5.rs:29:12
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2019-10-08 18:03:35 +00:00
|
|
|
LL | enum F<X: ?Sized> {
|
2023-06-14 17:22:03 +00:00
|
|
|
| - this type parameter needs to be `Sized`
|
2018-08-08 12:28:26 +00:00
|
|
|
LL | V2{f1: X, f: isize},
|
2020-07-10 22:13:49 +00:00
|
|
|
| ^ doesn't have a size known at compile-time
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
|
= note: no field of an enum variant may have a dynamically sized type
|
2020-07-10 22:13:49 +00:00
|
|
|
= help: change the field's type to have a statically known size
|
2021-07-24 01:47:53 +00:00
|
|
|
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
|
|
|
|
|
2021-06-22 02:07:19 +00:00
|
|
|
LL - enum F<X: ?Sized> {
|
|
|
|
LL + enum F<X> {
|
2022-06-08 17:34:57 +00:00
|
|
|
|
|
2020-07-10 22:13:49 +00:00
|
|
|
help: borrowed types always have a statically known size
|
|
|
|
|
|
|
|
|
LL | V2{f1: &X, f: isize},
|
2021-06-22 02:07:19 +00:00
|
|
|
| +
|
2020-07-14 19:18:01 +00:00
|
|
|
help: the `Box` type always has a statically known size and allocates its contents in the heap
|
2020-07-10 22:13:49 +00:00
|
|
|
|
|
|
|
|
LL | V2{f1: Box<X>, f: isize},
|
2021-06-22 02:07:19 +00:00
|
|
|
| ++++ +
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
error: aborting due to 6 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|