]> git.lizzy.rs Git - rust.git/blob - tests/ui/unsized/unsized5.stderr
internally change regions to be covariant
[rust.git] / tests / ui / unsized / unsized5.stderr
1 error[E0277]: the size for values of type `X` cannot be known at compilation time
2   --> $DIR/unsized5.rs:4:9
3    |
4 LL | struct S1<X: ?Sized> {
5    |           - this type parameter needs to be `std::marker::Sized`
6 LL |     f1: X,
7    |         ^ doesn't have a size known at compile-time
8    |
9    = note: only the last field of a struct 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 - struct S1<X: ?Sized> {
14 LL + struct S1<X> {
15    |
16 help: borrowed types always have a statically known size
17    |
18 LL |     f1: &X,
19    |         +
20 help: the `Box` type always has a statically known size and allocates its contents in the heap
21    |
22 LL |     f1: Box<X>,
23    |         ++++ +
24
25 error[E0277]: the size for values of type `X` cannot be known at compilation time
26   --> $DIR/unsized5.rs:10:8
27    |
28 LL | struct S2<X: ?Sized> {
29    |           - this type parameter needs to be `std::marker::Sized`
30 LL |     f: isize,
31 LL |     g: X,
32    |        ^ doesn't have a size known at compile-time
33    |
34    = note: only the last field of a struct may have a dynamically sized type
35    = help: change the field's type to have a statically known size
36 help: consider removing the `?Sized` bound to make the type parameter `Sized`
37    |
38 LL - struct S2<X: ?Sized> {
39 LL + struct S2<X> {
40    |
41 help: borrowed types always have a statically known size
42    |
43 LL |     g: &X,
44    |        +
45 help: the `Box` type always has a statically known size and allocates its contents in the heap
46    |
47 LL |     g: Box<X>,
48    |        ++++ +
49
50 error[E0277]: the size for values of type `str` cannot be known at compilation time
51   --> $DIR/unsized5.rs:15:8
52    |
53 LL |     f: str,
54    |        ^^^ doesn't have a size known at compile-time
55    |
56    = help: the trait `Sized` is not implemented for `str`
57    = note: only the last field of a struct may have a dynamically sized type
58    = help: change the field's type to have a statically known size
59 help: borrowed types always have a statically known size
60    |
61 LL |     f: &str,
62    |        +
63 help: the `Box` type always has a statically known size and allocates its contents in the heap
64    |
65 LL |     f: Box<str>,
66    |        ++++   +
67
68 error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
69   --> $DIR/unsized5.rs:20:8
70    |
71 LL |     f: [u8],
72    |        ^^^^ doesn't have a size known at compile-time
73    |
74    = help: the trait `Sized` is not implemented for `[u8]`
75    = note: only the last field of a struct may have a dynamically sized type
76    = help: change the field's type to have a statically known size
77 help: borrowed types always have a statically known size
78    |
79 LL |     f: &[u8],
80    |        +
81 help: the `Box` type always has a statically known size and allocates its contents in the heap
82    |
83 LL |     f: Box<[u8]>,
84    |        ++++    +
85
86 error[E0277]: the size for values of type `X` cannot be known at compilation time
87   --> $DIR/unsized5.rs:25:8
88    |
89 LL | enum E<X: ?Sized> {
90    |        - this type parameter needs to be `std::marker::Sized`
91 LL |     V1(X, isize),
92    |        ^ doesn't have a size known at compile-time
93    |
94    = note: no field of an enum variant may have a dynamically sized type
95    = help: change the field's type to have a statically known size
96 help: consider removing the `?Sized` bound to make the type parameter `Sized`
97    |
98 LL - enum E<X: ?Sized> {
99 LL + enum E<X> {
100    |
101 help: borrowed types always have a statically known size
102    |
103 LL |     V1(&X, isize),
104    |        +
105 help: the `Box` type always has a statically known size and allocates its contents in the heap
106    |
107 LL |     V1(Box<X>, isize),
108    |        ++++ +
109
110 error[E0277]: the size for values of type `X` cannot be known at compilation time
111   --> $DIR/unsized5.rs:29:12
112    |
113 LL | enum F<X: ?Sized> {
114    |        - this type parameter needs to be `std::marker::Sized`
115 LL |     V2{f1: X, f: isize},
116    |            ^ doesn't have a size known at compile-time
117    |
118    = note: no field of an enum variant may have a dynamically sized type
119    = help: change the field's type to have a statically known size
120 help: consider removing the `?Sized` bound to make the type parameter `Sized`
121    |
122 LL - enum F<X: ?Sized> {
123 LL + enum F<X> {
124    |
125 help: borrowed types always have a statically known size
126    |
127 LL |     V2{f1: &X, f: isize},
128    |            +
129 help: the `Box` type always has a statically known size and allocates its contents in the heap
130    |
131 LL |     V2{f1: Box<X>, f: isize},
132    |            ++++ +
133
134 error: aborting due to 6 previous errors
135
136 For more information about this error, try `rustc --explain E0277`.