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