]>
Commit | Line | Data |
---|---|---|
f035d41b | 1 | error[E0277]: the size for values of type `T` cannot be known at compilation time |
3dfed10e | 2 | --> $DIR/adt-param-with-implicit-sized-bound.rs:25:9 |
f035d41b XL |
3 | | |
4 | LL | struct X<T>(T); | |
5 | | - required by this bound in `X` | |
6 | ... | |
7 | LL | struct Struct5<T: ?Sized>{ | |
cdc7bbd5 | 8 | | - this type parameter needs to be `std::marker::Sized` |
f035d41b | 9 | LL | _t: X<T>, |
3dfed10e | 10 | | ^^^^ doesn't have a size known at compile-time |
f035d41b | 11 | | |
f035d41b XL |
12 | help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>` |
13 | --> $DIR/adt-param-with-implicit-sized-bound.rs:18:10 | |
14 | | | |
15 | LL | struct X<T>(T); | |
6a06907d | 16 | | ^ - ...if indirection were used here: `Box<T>` |
f035d41b XL |
17 | | | |
18 | | this could be changed to `T: ?Sized`... | |
19 | ||
20 | error[E0277]: the size for values of type `Self` cannot be known at compilation time | |
21 | --> $DIR/adt-param-with-implicit-sized-bound.rs:2:19 | |
22 | | | |
23 | LL | fn func1() -> Struct1<Self>; | |
24 | | ^^^^^^^^^^^^^ doesn't have a size known at compile-time | |
25 | ... | |
26 | LL | struct Struct1<T>{ | |
27 | | - required by this bound in `Struct1` | |
28 | | | |
f035d41b XL |
29 | help: consider further restricting `Self` |
30 | | | |
1b1a35ee XL |
31 | LL | fn func1() -> Struct1<Self> where Self: Sized; |
32 | | ^^^^^^^^^^^^^^^^^ | |
f035d41b XL |
33 | help: consider relaxing the implicit `Sized` restriction |
34 | | | |
35 | LL | struct Struct1<T: ?Sized>{ | |
36 | | ^^^^^^^^ | |
37 | ||
38 | error[E0277]: the size for values of type `Self` cannot be known at compilation time | |
39 | --> $DIR/adt-param-with-implicit-sized-bound.rs:3:23 | |
40 | | | |
41 | LL | fn func2<'a>() -> Struct2<'a, Self>; | |
42 | | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | |
43 | ... | |
44 | LL | struct Struct2<'a, T>{ | |
45 | | - required by this bound in `Struct2` | |
46 | | | |
f035d41b XL |
47 | help: consider further restricting `Self` |
48 | | | |
1b1a35ee XL |
49 | LL | fn func2<'a>() -> Struct2<'a, Self> where Self: Sized; |
50 | | ^^^^^^^^^^^^^^^^^ | |
f035d41b XL |
51 | help: consider relaxing the implicit `Sized` restriction |
52 | | | |
53 | LL | struct Struct2<'a, T: ?Sized>{ | |
54 | | ^^^^^^^^ | |
55 | ||
56 | error[E0277]: the size for values of type `Self` cannot be known at compilation time | |
57 | --> $DIR/adt-param-with-implicit-sized-bound.rs:4:19 | |
58 | | | |
59 | LL | fn func3() -> Struct3<Self>; | |
60 | | ^^^^^^^^^^^^^ doesn't have a size known at compile-time | |
61 | ... | |
62 | LL | struct Struct3<T>{ | |
63 | | - required by this bound in `Struct3` | |
64 | | | |
f035d41b XL |
65 | help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>` |
66 | --> $DIR/adt-param-with-implicit-sized-bound.rs:14:16 | |
67 | | | |
68 | LL | struct Struct3<T>{ | |
69 | | ^ this could be changed to `T: ?Sized`... | |
70 | LL | _t: T, | |
6a06907d | 71 | | - ...if indirection were used here: `Box<T>` |
f035d41b XL |
72 | help: consider further restricting `Self` |
73 | | | |
1b1a35ee XL |
74 | LL | fn func3() -> Struct3<Self> where Self: Sized; |
75 | | ^^^^^^^^^^^^^^^^^ | |
f035d41b XL |
76 | |
77 | error[E0277]: the size for values of type `Self` cannot be known at compilation time | |
78 | --> $DIR/adt-param-with-implicit-sized-bound.rs:5:19 | |
79 | | | |
80 | LL | fn func4() -> Struct4<Self>; | |
81 | | ^^^^^^^^^^^^^ doesn't have a size known at compile-time | |
82 | ... | |
83 | LL | struct Struct4<T>{ | |
84 | | - required by this bound in `Struct4` | |
85 | | | |
f035d41b XL |
86 | help: consider further restricting `Self` |
87 | | | |
1b1a35ee XL |
88 | LL | fn func4() -> Struct4<Self> where Self: Sized; |
89 | | ^^^^^^^^^^^^^^^^^ | |
f035d41b XL |
90 | help: consider relaxing the implicit `Sized` restriction |
91 | | | |
92 | LL | struct Struct4<T: ?Sized>{ | |
93 | | ^^^^^^^^ | |
94 | ||
95 | error: aborting due to 5 previous errors | |
96 | ||
97 | For more information about this error, try `rustc --explain E0277`. |