Weird type inference around impl Trait and async #124757
Labels
A-async-await
Area: Async & Await
A-inference
Area: Type inference
AsyncAwait-Triaged
Async-await issues that have been triaged during a working group meeting.
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Following code doesn't work on all the compilers I've checked, e.g. 1.80.0-nightly
This is surprising because a lot of alterations to this code fixes the issue, for example replacing
map(|x| *x)
withcopied()
, which is seemingly an equivalent replacement. Moreover, replacingimpl Future
withSelf::Future
also solves the problem:Also the error text is very cryptic:
And because of how
async
works it can easily leak across the functions:This function reports
In a function without a single lifetime argument. You may get some very confusing on the very top of your
async
stack because somewhere underneath there is one future that violates theSend
constraint.I'm not entirely sure if this is a diganostic error or a compiler issue, but i believe that the original code with
impl Future
should have been managed to infer that the resulting future isSend
. the fact that this doesn't work:But this does
Makes me think that this have to be a compiler issue
The text was updated successfully, but these errors were encountered: