File: bad-self-type.stderr

package info (click to toggle)
rustc-web 1.70.0%2Bdfsg1-7~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,517,036 kB
  • sloc: xml: 147,962; javascript: 10,210; sh: 8,590; python: 8,220; ansic: 5,901; cpp: 4,635; makefile: 4,006; asm: 2,856
file content (50 lines) | stat: -rw-r--r-- 1,735 bytes parent folder | download | duplicates (3)
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
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`
   |             help: change the self-receiver type to match the trait: `self: Pin<&mut MyFuture>`
   |
   = note: expected signature `fn(Pin<&mut MyFuture>, &mut Context<'_>) -> Poll<_>`
              found signature `fn(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>`
   |            help: change the self-receiver type to match the trait: `self`
   |
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>)`

error[E0053]: method `bar` has an incompatible type for trait
  --> $DIR/bad-self-type.rs:24:18
   |
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`.