fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
4.5 KiB136 linesraw
1error[E0277]: the size for values of type `X` cannot be known at compilation time
2  --> $DIR/unsized5.rs:4:9
3   |
4LL | struct S1<X: ?Sized> {
5   |           - this type parameter needs to be `Sized`
6LL |     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
11help: consider removing the `?Sized` bound to make the type parameter `Sized`
12   |
13LL - struct S1<X: ?Sized> {
14LL + struct S1<X> {
15   |
16help: borrowed types always have a statically known size
17   |
18LL |     f1: &X,
19   |         +
20help: the `Box` type always has a statically known size and allocates its contents in the heap
21   |
22LL |     f1: Box<X>,
23   |         ++++ +
24
25error[E0277]: the size for values of type `X` cannot be known at compilation time
26  --> $DIR/unsized5.rs:10:8
27   |
28LL | struct S2<X: ?Sized> {
29   |           - this type parameter needs to be `Sized`
30LL |     f: isize,
31LL |     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
36help: consider removing the `?Sized` bound to make the type parameter `Sized`
37   |
38LL - struct S2<X: ?Sized> {
39LL + struct S2<X> {
40   |
41help: borrowed types always have a statically known size
42   |
43LL |     g: &X,
44   |        +
45help: the `Box` type always has a statically known size and allocates its contents in the heap
46   |
47LL |     g: Box<X>,
48   |        ++++ +
49
50error[E0277]: the size for values of type `str` cannot be known at compilation time
51  --> $DIR/unsized5.rs:15:8
52   |
53LL |     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
59help: borrowed types always have a statically known size
60   |
61LL |     f: &str,
62   |        +
63help: the `Box` type always has a statically known size and allocates its contents in the heap
64   |
65LL |     f: Box<str>,
66   |        ++++   +
67
68error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
69  --> $DIR/unsized5.rs:20:8
70   |
71LL |     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
77help: borrowed types always have a statically known size
78   |
79LL |     f: &[u8],
80   |        +
81help: the `Box` type always has a statically known size and allocates its contents in the heap
82   |
83LL |     f: Box<[u8]>,
84   |        ++++    +
85
86error[E0277]: the size for values of type `X` cannot be known at compilation time
87  --> $DIR/unsized5.rs:25:8
88   |
89LL | enum E<X: ?Sized> {
90   |        - this type parameter needs to be `Sized`
91LL |     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
96help: consider removing the `?Sized` bound to make the type parameter `Sized`
97   |
98LL - enum E<X: ?Sized> {
99LL + enum E<X> {
100   |
101help: borrowed types always have a statically known size
102   |
103LL |     V1(&X, isize),
104   |        +
105help: the `Box` type always has a statically known size and allocates its contents in the heap
106   |
107LL |     V1(Box<X>, isize),
108   |        ++++ +
109
110error[E0277]: the size for values of type `X` cannot be known at compilation time
111  --> $DIR/unsized5.rs:29:12
112   |
113LL | enum F<X: ?Sized> {
114   |        - this type parameter needs to be `Sized`
115LL |     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
120help: consider removing the `?Sized` bound to make the type parameter `Sized`
121   |
122LL - enum F<X: ?Sized> {
123LL + enum F<X> {
124   |
125help: borrowed types always have a statically known size
126   |
127LL |     V2{f1: &X, f: isize},
128   |            +
129help: the `Box` type always has a statically known size and allocates its contents in the heap
130   |
131LL |     V2{f1: Box<X>, f: isize},
132   |            ++++ +
133
134error: aborting due to 6 previous errors
135
136For more information about this error, try `rustc --explain E0277`.