Stream: general

Topic: Unhelpful/wrong compiler error


Francesco Dainese (Jul 15 2019 at 15:27, on Zulip):

Hello everyone.
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.

Francesco Dainese (Jul 22 2019 at 15:17, on Zulip):

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...

Jake Goulding (Jul 22 2019 at 15:21, on Zulip):

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.

RalfJ (Jul 22 2019 at 15:25, on Zulip):

@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.
Cc @WG-async-foundations

Jake Goulding (Jul 22 2019 at 15:29, on Zulip):

And @WG-diagnostics

Esteban K├╝ber (Aug 08 2019 at 17:17, on Zulip):

Misleading diagnostics are certainly treated as bugs. Feel free to file a ticket as advised above.

Last update: Nov 20 2019 at 12:20UTC