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