Today I was trying to implement an extremely simple executor for futures, when I stumbled upon a confusing compiler error.
Cargo was telling me that my
F: Future type wasn't implementing
poll, or that I should import
std::future::Future, as seen here: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=c3e73222132e8f6a58330ae926ec055c
The problem is that the error is instead due to the fact that
poll expects a
Pin, as seen here: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=51fa7ab7533890fb8190525d973fcc10
Since, after putting my future inside a
Pin, it compiled (and run) succesfully.
I wanted to get this under the team eyes, both to get some clarification if that's intended or not and how (if) to proceed in making this error clearer. It's been a week now and I haven't heard from anyone...
I agree that the error message isn't maximally useful. The actual implementation of how I can't help with. Conceptually, it seems like you might want to search through the possible self receivers and see if any of them implement the trait. However, this seems like a large space to search through.
@Francesco Dainese since you did not get a response here, creating an issue on the tracker seems reasonable. that does not guarantee anything but it is at least less ephemeral than Zulip.
Misleading diagnostics are certainly treated as bugs. Feel free to file a ticket as advised above.