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 `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: borrowed types always have a statically known size
15 help: the `Box` type always has a statically known size and allocates its contents in the heap
20 error[E0277]: the size for values of type `X` cannot be known at compilation time
21 --> $DIR/unsized5.rs:10:8
23 LL | struct S2<X: ?Sized> {
24 | - this type parameter needs to be `Sized`
27 | ^ doesn't have a size known at compile-time
29 = note: only the last field of a struct may have a dynamically sized type
30 = help: change the field's type to have a statically known size
31 help: borrowed types always have a statically known size
35 help: the `Box` type always has a statically known size and allocates its contents in the heap
40 error[E0277]: the size for values of type `str` cannot be known at compilation time
41 --> $DIR/unsized5.rs:15:8
44 | ^^^ doesn't have a size known at compile-time
46 = help: the trait `Sized` is not implemented for `str`
47 = note: only the last field of a struct may have a dynamically sized type
48 = help: change the field's type to have a statically known size
49 help: borrowed types always have a statically known size
53 help: the `Box` type always has a statically known size and allocates its contents in the heap
58 error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
59 --> $DIR/unsized5.rs:20:8
62 | ^^^^ doesn't have a size known at compile-time
64 = help: the trait `Sized` is not implemented for `[u8]`
65 = note: only the last field of a struct may have a dynamically sized type
66 = help: change the field's type to have a statically known size
67 help: borrowed types always have a statically known size
71 help: the `Box` type always has a statically known size and allocates its contents in the heap
76 error[E0277]: the size for values of type `X` cannot be known at compilation time
77 --> $DIR/unsized5.rs:25:8
79 LL | enum E<X: ?Sized> {
80 | - this type parameter needs to be `Sized`
82 | ^ doesn't have a size known at compile-time
84 = note: no field of an enum variant may have a dynamically sized type
85 = help: change the field's type to have a statically known size
86 help: borrowed types always have a statically known size
90 help: the `Box` type always has a statically known size and allocates its contents in the heap
92 LL | V1(Box<X>, isize),
95 error[E0277]: the size for values of type `X` cannot be known at compilation time
96 --> $DIR/unsized5.rs:29:12
98 LL | enum F<X: ?Sized> {
99 | - this type parameter needs to be `Sized`
100 LL | V2{f1: X, f: isize},
101 | ^ doesn't have a size known at compile-time
103 = note: no field of an enum variant may have a dynamically sized type
104 = help: change the field's type to have a statically known size
105 help: borrowed types always have a statically known size
107 LL | V2{f1: &X, f: isize},
109 help: the `Box` type always has a statically known size and allocates its contents in the heap
111 LL | V2{f1: Box<X>, f: isize},
114 error: aborting due to 6 previous errors
116 For more information about this error, try `rustc --explain E0277`.