]> git.proxmox.com Git - rustc.git/blame - src/test/ui/union/union-sized-field.stderr
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / ui / union / union-sized-field.stderr
CommitLineData
8faf50e0 1error[E0277]: the size for values of type `T` cannot be known at compilation time
3dfed10e 2 --> $DIR/union-sized-field.rs:4:12
3b2f2976 3 |
e74abb32 4LL | union Foo<T: ?Sized> {
cdc7bbd5 5 | - this type parameter needs to be `std::marker::Sized`
064997fb
FG
6LL | value: ManuallyDrop<T>,
7 | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
3b2f2976 8 |
064997fb 9 = note: required because it appears within the type `ManuallyDrop<T>`
3b2f2976 10 = note: no field of a union may have a dynamically sized type
3dfed10e 11 = help: change the field's type to have a statically known size
94222f64
XL
12help: consider removing the `?Sized` bound to make the type parameter `Sized`
13 |
14LL - union Foo<T: ?Sized> {
15LL + union Foo<T> {
923072b8 16 |
3dfed10e
XL
17help: borrowed types always have a statically known size
18 |
064997fb 19LL | value: &ManuallyDrop<T>,
94222f64 20 | +
3dfed10e
XL
21help: the `Box` type always has a statically known size and allocates its contents in the heap
22 |
064997fb
FG
23LL | value: Box<ManuallyDrop<T>>,
24 | ++++ +
3b2f2976 25
8faf50e0 26error[E0277]: the size for values of type `T` cannot be known at compilation time
3dfed10e 27 --> $DIR/union-sized-field.rs:9:12
3b2f2976 28 |
e74abb32 29LL | struct Foo2<T: ?Sized> {
cdc7bbd5 30 | - this type parameter needs to be `std::marker::Sized`
064997fb
FG
31LL | value: ManuallyDrop<T>,
32 | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
3b2f2976 33 |
064997fb 34 = note: required because it appears within the type `ManuallyDrop<T>`
3b2f2976 35 = note: only the last field of a struct may have a dynamically sized type
3dfed10e 36 = help: change the field's type to have a statically known size
94222f64
XL
37help: consider removing the `?Sized` bound to make the type parameter `Sized`
38 |
39LL - struct Foo2<T: ?Sized> {
40LL + struct Foo2<T> {
923072b8 41 |
3dfed10e
XL
42help: borrowed types always have a statically known size
43 |
064997fb 44LL | value: &ManuallyDrop<T>,
94222f64 45 | +
3dfed10e
XL
46help: the `Box` type always has a statically known size and allocates its contents in the heap
47 |
064997fb
FG
48LL | value: Box<ManuallyDrop<T>>,
49 | ++++ +
3b2f2976 50
8faf50e0 51error[E0277]: the size for values of type `T` cannot be known at compilation time
0731742a 52 --> $DIR/union-sized-field.rs:15:11
3b2f2976 53 |
e74abb32 54LL | enum Foo3<T: ?Sized> {
cdc7bbd5 55 | - this type parameter needs to be `std::marker::Sized`
064997fb
FG
56LL | Value(ManuallyDrop<T>),
57 | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
3b2f2976 58 |
064997fb 59 = note: required because it appears within the type `ManuallyDrop<T>`
3b2f2976 60 = note: no field of an enum variant may have a dynamically sized type
3dfed10e 61 = help: change the field's type to have a statically known size
94222f64
XL
62help: consider removing the `?Sized` bound to make the type parameter `Sized`
63 |
64LL - enum Foo3<T: ?Sized> {
65LL + enum Foo3<T> {
923072b8 66 |
3dfed10e
XL
67help: borrowed types always have a statically known size
68 |
064997fb 69LL | Value(&ManuallyDrop<T>),
94222f64 70 | +
3dfed10e
XL
71help: the `Box` type always has a statically known size and allocates its contents in the heap
72 |
064997fb
FG
73LL | Value(Box<ManuallyDrop<T>>),
74 | ++++ +
3b2f2976
XL
75
76error: aborting due to 3 previous errors
77
0531ce1d 78For more information about this error, try `rustc --explain E0277`.