Skip to content

Hint about missing trait method suggests incorrect code (self parameter not named "self"). #71150

Closed
@steffahn

Description

@steffahn

In the error message below, the first argument of poll is not named self.

use core::future::Future;

struct S;
impl Future for S {}

(Playground)

Errors:

   Compiling playground v0.0.1 (/playground)
error[E0046]: not all trait items implemented, missing: `Output`, `poll`
 --> src/lib.rs:4:1
  |
4 | impl Future for S {}
  | ^^^^^^^^^^^^^^^^^ missing `Output`, `poll` in implementation
  |
  = help: implement the missing item: `type Output = Type;`
  = help: implement the missing item: `fn poll(_: std::pin::Pin<&mut Self>, _: &mut std::task::Context<'_>) -> std::task::Poll<<Self as std::future::Future>::Output> { unimplemented!() }`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0046`.
error: could not compile `playground`.

To learn more, run the command again with --verbose.

@rustbot modify labels: T-compiler, A-diagnostics, C-enhancement, D-papercut, F-arbitrary_self_types.

This issue has been assigned to @Duddino via this comment.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.F-arbitrary_self_types`#![feature(arbitrary_self_types)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions