]> git.lizzy.rs Git - rust.git/blob - src/test/ui/union/union-sized-field.stderr
d7224e46add3dfc85d005e2026802aeb26175c6e
[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: T,
7    |            ^ doesn't have a size known at compile-time
8    |
9    = note: no field of a union may have a dynamically sized type
10    = help: change the field's type to have a statically known size
11 help: borrowed types always have a statically known size
12    |
13 LL |     value: &T,
14    |            ^
15 help: heap allocated types always have a statically known size
16    |
17 LL |     value: Box<T>,
18    |            ^^^^ ^
19
20 error[E0277]: the size for values of type `T` cannot be known at compilation time
21   --> $DIR/union-sized-field.rs:9:12
22    |
23 LL | struct Foo2<T: ?Sized> {
24    |             - this type parameter needs to be `std::marker::Sized`
25 LL |     value: T,
26    |            ^ doesn't have a size known at compile-time
27    |
28    = note: only the last field of a struct may have a dynamically sized type
29    = help: change the field's type to have a statically known size
30 help: borrowed types always have a statically known size
31    |
32 LL |     value: &T,
33    |            ^
34 help: heap allocated types always have a statically known size
35    |
36 LL |     value: Box<T>,
37    |            ^^^^ ^
38
39 error[E0277]: the size for values of type `T` cannot be known at compilation time
40   --> $DIR/union-sized-field.rs:15:11
41    |
42 LL | enum Foo3<T: ?Sized> {
43    |           - this type parameter needs to be `std::marker::Sized`
44 LL |     Value(T),
45    |           ^ doesn't have a size known at compile-time
46    |
47    = note: no field of an enum variant may have a dynamically sized type
48    = help: change the field's type to have a statically known size
49 help: borrowed types always have a statically known size
50    |
51 LL |     Value(&T),
52    |           ^
53 help: heap allocated types always have a statically known size
54    |
55 LL |     Value(Box<T>),
56    |           ^^^^ ^
57
58 error: aborting due to 3 previous errors
59
60 For more information about this error, try `rustc --explain E0277`.