2018-07-10 21:10:13 +00:00
|
|
|
error[E0277]: the size for values of type `T` cannot be known at compilation time
|
2020-07-10 22:13:49 +00:00
|
|
|
--> $DIR/union-sized-field.rs:4:12
|
2017-08-16 11:32:41 +00:00
|
|
|
|
|
2019-10-08 18:03:35 +00:00
|
|
|
LL | union Foo<T: ?Sized> {
|
2021-03-30 09:56:39 +00:00
|
|
|
| - this type parameter needs to be `std::marker::Sized`
|
2018-06-09 23:53:36 +00:00
|
|
|
LL | value: T,
|
2020-07-10 22:13:49 +00:00
|
|
|
| ^ doesn't have a size known at compile-time
|
2017-08-16 11:32:41 +00:00
|
|
|
|
|
2017-08-16 16:45:54 +00:00
|
|
|
= note: no field of a union 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 - union Foo<T: ?Sized> {
|
|
|
|
LL + union Foo<T> {
|
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 | value: &T,
|
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 | value: Box<T>,
|
2021-06-22 02:07:19 +00:00
|
|
|
| ++++ +
|
2017-08-16 11:32:41 +00:00
|
|
|
|
2018-07-10 21:10:13 +00:00
|
|
|
error[E0277]: the size for values of type `T` cannot be known at compilation time
|
2020-07-10 22:13:49 +00:00
|
|
|
--> $DIR/union-sized-field.rs:9:12
|
2017-08-16 16:45:54 +00:00
|
|
|
|
|
2019-10-08 18:03:35 +00:00
|
|
|
LL | struct Foo2<T: ?Sized> {
|
2021-03-30 09:56:39 +00:00
|
|
|
| - this type parameter needs to be `std::marker::Sized`
|
2018-06-09 23:53:36 +00:00
|
|
|
LL | value: T,
|
2020-07-10 22:13:49 +00:00
|
|
|
| ^ doesn't have a size known at compile-time
|
2017-08-16 16:45:54 +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 Foo2<T: ?Sized> {
|
|
|
|
LL + struct Foo2<T> {
|
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 | value: &T,
|
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 | value: Box<T>,
|
2021-06-22 02:07:19 +00:00
|
|
|
| ++++ +
|
2017-08-16 16:45:54 +00:00
|
|
|
|
2018-07-10 21:10:13 +00:00
|
|
|
error[E0277]: the size for values of type `T` cannot be known at compilation time
|
2018-12-25 15:56:47 +00:00
|
|
|
--> $DIR/union-sized-field.rs:15:11
|
2017-08-16 16:45:54 +00:00
|
|
|
|
|
2019-10-08 18:03:35 +00:00
|
|
|
LL | enum Foo3<T: ?Sized> {
|
2021-03-30 09:56:39 +00:00
|
|
|
| - this type parameter needs to be `std::marker::Sized`
|
2018-06-09 23:53:36 +00:00
|
|
|
LL | Value(T),
|
2018-06-19 22:53:51 +00:00
|
|
|
| ^ doesn't have a size known at compile-time
|
2017-08-16 16:45:54 +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 Foo3<T: ?Sized> {
|
|
|
|
LL + enum Foo3<T> {
|
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 | Value(&T),
|
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 | Value(Box<T>),
|
2021-06-22 02:07:19 +00:00
|
|
|
| ++++ +
|
2017-08-16 16:45:54 +00:00
|
|
|
|
|
|
|
error: aborting due to 3 previous errors
|
2017-08-16 11:32:41 +00:00
|
|
|
|
2018-03-03 14:59:40 +00:00
|
|
|
For more information about this error, try `rustc --explain E0277`.
|