]> git.proxmox.com Git - rustc.git/blob - src/test/ui/unsized5.stderr
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / ui / 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 `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: borrowed types always have a statically known size
12 |
13 LL | f1: &X,
14 | ^
15 help: the `Box` type always has a statically known size and allocates its contents in the heap
16 |
17 LL | f1: Box<X>,
18 | ^^^^ ^
19
20 error[E0277]: the size for values of type `X` cannot be known at compilation time
21 --> $DIR/unsized5.rs:10:8
22 |
23 LL | struct S2<X: ?Sized> {
24 | - this type parameter needs to be `Sized`
25 LL | f: isize,
26 LL | g: X,
27 | ^ doesn't have a size known at compile-time
28 |
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
32 |
33 LL | g: &X,
34 | ^
35 help: the `Box` type always has a statically known size and allocates its contents in the heap
36 |
37 LL | g: Box<X>,
38 | ^^^^ ^
39
40 error[E0277]: the size for values of type `str` cannot be known at compilation time
41 --> $DIR/unsized5.rs:15:8
42 |
43 LL | f: str,
44 | ^^^ doesn't have a size known at compile-time
45 |
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
50 |
51 LL | f: &str,
52 | ^
53 help: the `Box` type always has a statically known size and allocates its contents in the heap
54 |
55 LL | f: Box<str>,
56 | ^^^^ ^
57
58 error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
59 --> $DIR/unsized5.rs:20:8
60 |
61 LL | f: [u8],
62 | ^^^^ doesn't have a size known at compile-time
63 |
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
68 |
69 LL | f: &[u8],
70 | ^
71 help: the `Box` type always has a statically known size and allocates its contents in the heap
72 |
73 LL | f: Box<[u8]>,
74 | ^^^^ ^
75
76 error[E0277]: the size for values of type `X` cannot be known at compilation time
77 --> $DIR/unsized5.rs:25:8
78 |
79 LL | enum E<X: ?Sized> {
80 | - this type parameter needs to be `Sized`
81 LL | V1(X, isize),
82 | ^ doesn't have a size known at compile-time
83 |
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
87 |
88 LL | V1(&X, isize),
89 | ^
90 help: the `Box` type always has a statically known size and allocates its contents in the heap
91 |
92 LL | V1(Box<X>, isize),
93 | ^^^^ ^
94
95 error[E0277]: the size for values of type `X` cannot be known at compilation time
96 --> $DIR/unsized5.rs:29:12
97 |
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
102 |
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
106 |
107 LL | V2{f1: &X, f: isize},
108 | ^
109 help: the `Box` type always has a statically known size and allocates its contents in the heap
110 |
111 LL | V2{f1: Box<X>, f: isize},
112 | ^^^^ ^
113
114 error: aborting due to 6 previous errors
115
116 For more information about this error, try `rustc --explain E0277`.