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