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> {
|
2020-02-02 04:03:54 -06: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
|
|
|
|
help: borrowed types always have a statically known size
|
|
|
|
|
|
|
|
|
LL | data: &T,
|
|
|
|
| ^
|
|
|
|
help: heap allocated types always have a statically known size
|
|
|
|
|
|
|
|
|
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`.
|