]> git.lizzy.rs Git - rust.git/blob - src/test/ui/compare-method/bad-self-type.stderr
Rollup merge of #89468 - FabianWolff:issue-89358, r=jackh726
[rust.git] / src / test / ui / compare-method / bad-self-type.stderr
1 error[E0053]: method `poll` has an incompatible type for trait
2   --> $DIR/bad-self-type.rs:10:13
3    |
4 LL |     fn poll(self, _: &mut Context<'_>) -> Poll<()> {
5    |             ^^^^
6    |             |
7    |             expected struct `Pin`, found struct `MyFuture`
8    |             help: change the self-receiver type to match the trait: `self: Pin<&mut MyFuture>`
9    |
10    = note: expected fn pointer `fn(Pin<&mut MyFuture>, &mut Context<'_>) -> Poll<_>`
11               found fn pointer `fn(MyFuture, &mut Context<'_>) -> Poll<_>`
12
13 error[E0053]: method `foo` has an incompatible type for trait
14   --> $DIR/bad-self-type.rs:22:18
15    |
16 LL |     fn foo(self);
17    |            ---- type in trait
18 ...
19 LL |     fn foo(self: Box<Self>) {}
20    |            ------^^^^^^^^^
21    |            |     |
22    |            |     expected struct `MyFuture`, found struct `Box`
23    |            help: change the self-receiver type to match the trait: `self`
24    |
25    = note: expected fn pointer `fn(MyFuture)`
26               found fn pointer `fn(Box<MyFuture>)`
27
28 error[E0053]: method `bar` has an incompatible type for trait
29   --> $DIR/bad-self-type.rs:24:18
30    |
31 LL |     fn bar(self) -> Option<()>;
32    |                     ---------- type in trait
33 ...
34 LL |     fn bar(self) {}
35    |                  ^ expected enum `Option`, found `()`
36    |
37    = note: expected fn pointer `fn(MyFuture) -> Option<()>`
38               found fn pointer `fn(MyFuture)`
39 help: change the output type to match the trait
40    |
41 LL |     fn bar(self) -> Option<()> {}
42    |                  +++++++++++++
43
44 error: aborting due to 3 previous errors
45
46 For more information about this error, try `rustc --explain E0053`.