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