2018-07-15 16:11:54 -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/issue-27060-2.rs:3:11
|
2018-07-15 16:11:54 -05:00
|
|
|
|
|
2019-10-08 13:03:35 -05:00
|
|
|
LL | pub struct Bad<T: ?Sized> {
|
2021-03-30 04:56:39 -05:00
|
|
|
| - this type parameter needs to be `std::marker::Sized`
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | data: T,
|
2020-07-10 17:13:49 -05:00
|
|
|
| ^ doesn't have a size known at compile-time
|
2018-07-15 16:11:54 -05:00
|
|
|
|
|
2018-08-14 05:50:01 -05:00
|
|
|
= note: the last field of a packed struct may only have a dynamically sized type if it does not need drop to be run
|
2020-07-10 17:13:49 -05:00
|
|
|
= help: change the field's type to have a statically known size
|
2021-07-23 20:47:53 -05:00
|
|
|
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
|
|
|
|
|
|
|
|
LL | pub struct Bad<T> {
|
|
|
|
| --
|
2020-07-10 17:13:49 -05:00
|
|
|
help: borrowed types always have a statically known size
|
|
|
|
|
|
|
|
|
LL | data: &T,
|
|
|
|
| ^
|
2020-07-14 14:18:01 -05:00
|
|
|
help: the `Box` type always has a statically known size and allocates its contents in the heap
|
2020-07-10 17:13:49 -05:00
|
|
|
|
|
|
|
|
LL | data: Box<T>,
|
|
|
|
| ^^^^ ^
|
2018-07-15 16:11:54 -05:00
|
|
|
|
|
|
|
error: aborting due to previous error
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|