rust/tests/ui/union/union-sized-field.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

79 lines
3.0 KiB
Plaintext
Raw Normal View History

2018-07-10 16:10:13 -05:00
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/union-sized-field.rs:4:12
|
2019-10-08 13:03:35 -05:00
LL | union Foo<T: ?Sized> {
| - this type parameter needs to be `std::marker::Sized`
2022-06-29 21:33:18 -05:00
LL | value: ManuallyDrop<T>,
| ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
2022-06-29 21:33:18 -05:00
= note: required because it appears within the type `ManuallyDrop<T>`
= note: no field of a union may have a dynamically sized type
= help: change the field's type to have a statically known size
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
LL - union Foo<T: ?Sized> {
LL + union Foo<T> {
2022-06-08 12:34:57 -05:00
|
help: borrowed types always have a statically known size
|
2022-06-29 21:33:18 -05:00
LL | value: &ManuallyDrop<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
|
2022-06-29 21:33:18 -05:00
LL | value: Box<ManuallyDrop<T>>,
| ++++ +
2018-07-10 16:10:13 -05:00
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/union-sized-field.rs:9:12
|
2019-10-08 13:03:35 -05:00
LL | struct Foo2<T: ?Sized> {
| - this type parameter needs to be `std::marker::Sized`
2022-06-29 21:33:18 -05:00
LL | value: ManuallyDrop<T>,
| ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
2022-06-29 21:33:18 -05:00
= note: required because it appears within the type `ManuallyDrop<T>`
= note: only the last field of a struct may have a dynamically sized type
= help: change the field's type to have a statically known size
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
LL - struct Foo2<T: ?Sized> {
LL + struct Foo2<T> {
2022-06-08 12:34:57 -05:00
|
help: borrowed types always have a statically known size
|
2022-06-29 21:33:18 -05:00
LL | value: &ManuallyDrop<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
|
2022-06-29 21:33:18 -05:00
LL | value: Box<ManuallyDrop<T>>,
| ++++ +
2018-07-10 16:10:13 -05:00
error[E0277]: the size for values of type `T` cannot be known at compilation time
2018-12-25 09:56:47 -06:00
--> $DIR/union-sized-field.rs:15:11
|
2019-10-08 13:03:35 -05:00
LL | enum Foo3<T: ?Sized> {
| - this type parameter needs to be `std::marker::Sized`
2022-06-29 21:33:18 -05:00
LL | Value(ManuallyDrop<T>),
| ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
2022-06-29 21:33:18 -05:00
= note: required because it appears within the type `ManuallyDrop<T>`
= note: no field of an enum variant may have a dynamically sized type
= help: change the field's type to have a statically known size
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
LL - enum Foo3<T: ?Sized> {
LL + enum Foo3<T> {
2022-06-08 12:34:57 -05:00
|
help: borrowed types always have a statically known size
|
2022-06-29 21:33:18 -05:00
LL | Value(&ManuallyDrop<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
|
2022-06-29 21:33:18 -05:00
LL | Value(Box<ManuallyDrop<T>>),
| ++++ +
error: aborting due to 3 previous errors
2018-03-03 08:59:40 -06:00
For more information about this error, try `rustc --explain E0277`.