2022-06-11 22:47:21 +00:00
|
|
|
error[E0277]: the size for values of type `T` cannot be known at compilation time
|
|
|
|
--> $DIR/adt-param-with-implicit-sized-bound.rs:25:9
|
|
|
|
|
|
|
|
|
LL | struct Struct5<T: ?Sized>{
|
2023-06-14 17:22:03 +00:00
|
|
|
| - this type parameter needs to be `Sized`
|
2022-06-11 22:47:21 +00:00
|
|
|
LL | _t: X<T>,
|
|
|
|
| ^^^^ doesn't have a size known at compile-time
|
|
|
|
|
|
2024-01-24 21:29:15 +00:00
|
|
|
note: required by an implicit `Sized` bound in `X`
|
2022-06-11 22:47:21 +00:00
|
|
|
--> $DIR/adt-param-with-implicit-sized-bound.rs:18:10
|
|
|
|
|
|
|
|
|
LL | struct X<T>(T);
|
2024-01-30 19:47:45 +00:00
|
|
|
| ^ required by the implicit `Sized` requirement on this type parameter in `X`
|
2022-06-11 22:47:21 +00:00
|
|
|
help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>`
|
|
|
|
--> $DIR/adt-param-with-implicit-sized-bound.rs:18:10
|
|
|
|
|
|
|
|
|
LL | struct X<T>(T);
|
|
|
|
| ^ - ...if indirection were used here: `Box<T>`
|
|
|
|
| |
|
|
|
|
| this could be changed to `T: ?Sized`...
|
|
|
|
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
|
|
|
|
|
|
|
|
LL - struct Struct5<T: ?Sized>{
|
|
|
|
LL + struct Struct5<T>{
|
|
|
|
|
|
|
|
|
|
2020-06-12 00:41:16 +00:00
|
|
|
error[E0277]: the size for values of type `Self` cannot be known at compilation time
|
|
|
|
--> $DIR/adt-param-with-implicit-sized-bound.rs:2:19
|
|
|
|
|
|
|
|
|
LL | fn func1() -> Struct1<Self>;
|
|
|
|
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
|
|
|
|
|
2024-01-24 21:29:15 +00:00
|
|
|
note: required by an implicit `Sized` bound in `Struct1`
|
2021-07-31 16:26:55 +00:00
|
|
|
--> $DIR/adt-param-with-implicit-sized-bound.rs:8:16
|
|
|
|
|
|
|
|
|
LL | struct Struct1<T>{
|
2024-01-30 19:47:45 +00:00
|
|
|
| ^ required by the implicit `Sized` requirement on this type parameter in `Struct1`
|
2020-06-12 00:41:16 +00:00
|
|
|
help: consider further restricting `Self`
|
|
|
|
|
|
2020-09-02 07:40:56 +00:00
|
|
|
LL | fn func1() -> Struct1<Self> where Self: Sized;
|
2021-06-22 02:07:19 +00:00
|
|
|
| +++++++++++++++++
|
2020-06-12 00:41:16 +00:00
|
|
|
help: consider relaxing the implicit `Sized` restriction
|
|
|
|
|
|
|
|
|
LL | struct Struct1<T: ?Sized>{
|
2021-06-22 02:07:19 +00:00
|
|
|
| ++++++++
|
2020-06-12 00:41:16 +00:00
|
|
|
|
|
|
|
error[E0277]: the size for values of type `Self` cannot be known at compilation time
|
|
|
|
--> $DIR/adt-param-with-implicit-sized-bound.rs:3:23
|
|
|
|
|
|
|
|
|
LL | fn func2<'a>() -> Struct2<'a, Self>;
|
|
|
|
| ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
|
|
|
|
|
2024-01-24 21:29:15 +00:00
|
|
|
note: required by an implicit `Sized` bound in `Struct2`
|
2021-07-31 16:26:55 +00:00
|
|
|
--> $DIR/adt-param-with-implicit-sized-bound.rs:11:20
|
|
|
|
|
|
|
|
|
LL | struct Struct2<'a, T>{
|
2024-01-30 19:47:45 +00:00
|
|
|
| ^ required by the implicit `Sized` requirement on this type parameter in `Struct2`
|
2020-06-12 00:41:16 +00:00
|
|
|
help: consider further restricting `Self`
|
|
|
|
|
|
2020-09-02 07:40:56 +00:00
|
|
|
LL | fn func2<'a>() -> Struct2<'a, Self> where Self: Sized;
|
2021-06-22 02:07:19 +00:00
|
|
|
| +++++++++++++++++
|
2020-06-12 00:41:16 +00:00
|
|
|
help: consider relaxing the implicit `Sized` restriction
|
|
|
|
|
|
|
|
|
LL | struct Struct2<'a, T: ?Sized>{
|
2021-06-22 02:07:19 +00:00
|
|
|
| ++++++++
|
2020-06-12 00:41:16 +00:00
|
|
|
|
|
|
|
error[E0277]: the size for values of type `Self` cannot be known at compilation time
|
|
|
|
--> $DIR/adt-param-with-implicit-sized-bound.rs:4:19
|
|
|
|
|
|
|
|
|
LL | fn func3() -> Struct3<Self>;
|
|
|
|
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
|
|
|
|
|
2024-01-24 21:29:15 +00:00
|
|
|
note: required by an implicit `Sized` bound in `Struct3`
|
2021-07-31 16:26:55 +00:00
|
|
|
--> $DIR/adt-param-with-implicit-sized-bound.rs:14:16
|
|
|
|
|
|
|
|
|
LL | struct Struct3<T>{
|
2024-01-30 19:47:45 +00:00
|
|
|
| ^ required by the implicit `Sized` requirement on this type parameter in `Struct3`
|
2020-06-17 00:24:16 +00:00
|
|
|
help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>`
|
|
|
|
--> $DIR/adt-param-with-implicit-sized-bound.rs:14:16
|
|
|
|
|
|
|
|
|
LL | struct Struct3<T>{
|
|
|
|
| ^ this could be changed to `T: ?Sized`...
|
|
|
|
LL | _t: T,
|
2021-02-04 05:41:18 +00:00
|
|
|
| - ...if indirection were used here: `Box<T>`
|
2020-06-12 00:41:16 +00:00
|
|
|
help: consider further restricting `Self`
|
|
|
|
|
|
2020-09-02 07:40:56 +00:00
|
|
|
LL | fn func3() -> Struct3<Self> where Self: Sized;
|
2021-06-22 02:07:19 +00:00
|
|
|
| +++++++++++++++++
|
2020-06-12 00:41:16 +00:00
|
|
|
|
2020-06-17 00:24:16 +00:00
|
|
|
error[E0277]: the size for values of type `Self` cannot be known at compilation time
|
|
|
|
--> $DIR/adt-param-with-implicit-sized-bound.rs:5:19
|
|
|
|
|
|
|
|
|
LL | fn func4() -> Struct4<Self>;
|
|
|
|
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
|
|
|
|
|
2024-01-24 21:29:15 +00:00
|
|
|
note: required by an implicit `Sized` bound in `Struct4`
|
2021-07-31 16:26:55 +00:00
|
|
|
--> $DIR/adt-param-with-implicit-sized-bound.rs:20:16
|
|
|
|
|
|
|
|
|
LL | struct Struct4<T>{
|
2024-01-30 19:47:45 +00:00
|
|
|
| ^ required by the implicit `Sized` requirement on this type parameter in `Struct4`
|
2020-06-17 00:24:16 +00:00
|
|
|
help: consider further restricting `Self`
|
|
|
|
|
|
2020-09-02 07:40:56 +00:00
|
|
|
LL | fn func4() -> Struct4<Self> where Self: Sized;
|
2021-06-22 02:07:19 +00:00
|
|
|
| +++++++++++++++++
|
2020-06-17 00:24:16 +00:00
|
|
|
help: consider relaxing the implicit `Sized` restriction
|
|
|
|
|
|
|
|
|
LL | struct Struct4<T: ?Sized>{
|
2021-06-22 02:07:19 +00:00
|
|
|
| ++++++++
|
2020-06-17 00:24:16 +00:00
|
|
|
|
|
|
|
error: aborting due to 5 previous errors
|
2020-06-12 00:41:16 +00:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|