2020-06-16 19:24:16 -05:00
|
|
|
error[E0277]: the size for values of type `T` cannot be known at compilation time
|
2020-07-10 17:13:49 -05:00
|
|
|
--> $DIR/adt-param-with-implicit-sized-bound.rs:25:9
|
2020-06-16 19:24:16 -05:00
|
|
|
|
|
|
|
|
LL | struct X<T>(T);
|
|
|
|
| - required by this bound in `X`
|
|
|
|
...
|
|
|
|
LL | struct Struct5<T: ?Sized>{
|
|
|
|
| - this type parameter needs to be `std::marker::Sized`
|
|
|
|
LL | _t: X<T>,
|
2020-07-10 17:13:49 -05:00
|
|
|
| ^^^^ doesn't have a size known at compile-time
|
2020-06-16 19:24:16 -05: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 was used here: `Box<T>`
|
|
|
|
| |
|
|
|
|
| this could be changed to `T: ?Sized`...
|
|
|
|
|
2020-06-11 19:41:16 -05: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
|
|
|
|
...
|
|
|
|
LL | struct Struct1<T>{
|
|
|
|
| - required by this bound in `Struct1`
|
|
|
|
|
|
|
|
|
help: consider further restricting `Self`
|
|
|
|
|
|
|
|
|
LL | fn func1() -> Struct1<Self> where Self: std::marker::Sized;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
help: consider relaxing the implicit `Sized` restriction
|
|
|
|
|
|
|
|
|
LL | struct Struct1<T: ?Sized>{
|
|
|
|
| ^^^^^^^^
|
|
|
|
|
|
|
|
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
|
|
|
|
...
|
|
|
|
LL | struct Struct2<'a, T>{
|
|
|
|
| - required by this bound in `Struct2`
|
|
|
|
|
|
|
|
|
help: consider further restricting `Self`
|
|
|
|
|
|
|
|
|
LL | fn func2<'a>() -> Struct2<'a, Self> where Self: std::marker::Sized;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
help: consider relaxing the implicit `Sized` restriction
|
|
|
|
|
|
|
|
|
LL | struct Struct2<'a, T: ?Sized>{
|
|
|
|
| ^^^^^^^^
|
|
|
|
|
|
|
|
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
|
|
|
|
...
|
|
|
|
LL | struct Struct3<T>{
|
|
|
|
| - required by this bound in `Struct3`
|
|
|
|
|
|
2020-06-16 19:24:16 -05: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,
|
|
|
|
| - ...if indirection was used here: `Box<T>`
|
2020-06-11 19:41:16 -05:00
|
|
|
help: consider further restricting `Self`
|
|
|
|
|
|
|
|
|
LL | fn func3() -> Struct3<Self> where Self: std::marker::Sized;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2020-06-16 19:24:16 -05: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
|
|
|
|
...
|
|
|
|
LL | struct Struct4<T>{
|
|
|
|
| - required by this bound in `Struct4`
|
|
|
|
|
|
|
|
|
help: consider further restricting `Self`
|
|
|
|
|
|
|
|
|
LL | fn func4() -> Struct4<Self> where Self: std::marker::Sized;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
help: consider relaxing the implicit `Sized` restriction
|
|
|
|
|
|
|
|
|
LL | struct Struct4<T: ?Sized>{
|
|
|
|
| ^^^^^^^^
|
|
|
|
|
|
|
|
error: aborting due to 5 previous errors
|
2020-06-11 19:41:16 -05:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|