1 error[E0277]: the size for values of type `X` cannot be known at compilation time
2 --> $DIR/unsized5.rs:4:9
4 LL | struct S1<X: ?Sized> {
5 | - this type parameter needs to be `std::marker::Sized`
7 | ^ doesn't have a size known at compile-time
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`
13 LL - struct S1<X: ?Sized> {
16 help: borrowed types always have a statically known size
20 help: the `Box` type always has a statically known size and allocates its contents in the heap
25 error[E0277]: the size for values of type `X` cannot be known at compilation time
26 --> $DIR/unsized5.rs:10:8
28 LL | struct S2<X: ?Sized> {
29 | - this type parameter needs to be `std::marker::Sized`
32 | ^ doesn't have a size known at compile-time
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`
38 LL - struct S2<X: ?Sized> {
41 help: borrowed types always have a statically known size
45 help: the `Box` type always has a statically known size and allocates its contents in the heap
50 error[E0277]: the size for values of type `str` cannot be known at compilation time
51 --> $DIR/unsized5.rs:15:8
54 | ^^^ doesn't have a size known at compile-time
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
63 help: the `Box` type always has a statically known size and allocates its contents in the heap
68 error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
69 --> $DIR/unsized5.rs:20:8
72 | ^^^^ doesn't have a size known at compile-time
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
81 help: the `Box` type always has a statically known size and allocates its contents in the heap
86 error[E0277]: the size for values of type `X` cannot be known at compilation time
87 --> $DIR/unsized5.rs:25:8
89 LL | enum E<X: ?Sized> {
90 | - this type parameter needs to be `std::marker::Sized`
92 | ^ doesn't have a size known at compile-time
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`
98 LL - enum E<X: ?Sized> {
101 help: borrowed types always have a statically known size
105 help: the `Box` type always has a statically known size and allocates its contents in the heap
107 LL | V1(Box<X>, isize),
110 error[E0277]: the size for values of type `X` cannot be known at compilation time
111 --> $DIR/unsized5.rs:29:12
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
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`
122 LL - enum F<X: ?Sized> {
125 help: borrowed types always have a statically known size
127 LL | V2{f1: &X, f: isize},
129 help: the `Box` type always has a statically known size and allocates its contents in the heap
131 LL | V2{f1: Box<X>, f: isize},
134 error: aborting due to 6 previous errors
136 For more information about this error, try `rustc --explain E0277`.