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