File: bad-self-type.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (52 lines) | stat: -rw-r--r-- 1,765 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
error[E0053]: method `poll` has an incompatible type for trait
  --> $DIR/bad-self-type.rs:10:13
   |
LL |     fn poll(self, _: &mut Context<'_>) -> Poll<()> {
   |             ^^^^ expected `Pin<&mut MyFuture>`, found `MyFuture`
   |
   = note: expected signature `fn(Pin<&mut MyFuture>, &mut Context<'_>) -> Poll<_>`
              found signature `fn(MyFuture, &mut Context<'_>) -> Poll<_>`
help: change the self-receiver type to match the trait
   |
LL |     fn poll(self: Pin<&mut MyFuture>, _: &mut Context<'_>) -> Poll<()> {
   |             ~~~~~~~~~~~~~~~~~~~~~~~~

error[E0053]: method `foo` has an incompatible type for trait
  --> $DIR/bad-self-type.rs:22:18
   |
LL |     fn foo(self: Box<Self>) {}
   |                  ^^^^^^^^^ expected `MyFuture`, found `Box<MyFuture>`
   |
note: type in trait
  --> $DIR/bad-self-type.rs:17:12
   |
LL |     fn foo(self);
   |            ^^^^
   = note: expected signature `fn(MyFuture)`
              found signature `fn(Box<MyFuture>)`
help: change the self-receiver type to match the trait
   |
LL |     fn foo(self) {}
   |            ~~~~

error[E0053]: method `bar` has an incompatible type for trait
  --> $DIR/bad-self-type.rs:24:17
   |
LL |     fn bar(self) {}
   |                 ^ expected `Option<()>`, found `()`
   |
note: type in trait
  --> $DIR/bad-self-type.rs:18:21
   |
LL |     fn bar(self) -> Option<()>;
   |                     ^^^^^^^^^^
   = note: expected signature `fn(MyFuture) -> Option<()>`
              found signature `fn(MyFuture) -> ()`
help: change the output type to match the trait
   |
LL |     fn bar(self) -> Option<()> {}
   |                  +++++++++++++

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0053`.