I cannot use .boxed() because it triggers errors about "one type is more general than the other".
So I use Box::pin() instead which works fine. However, the reason I use box at all here is that I need to reduce the type size of the future because I hit the compiler limit, so I need to cast it to Box<Pin<dyn ..>> I suppose? Will that help?
But it seems I cannot escape my fate which is "one type is more general than the other": Rust Playground (edit: wrong link)
I have been wrestling with these errors almost a whole week and I'm desperate for a solution. Please help
I know that removing that line solves the problem, and I forgot to say: this is a very reduced test case deriving from a larger application where I actually need the then call, but where I do something more, namely
.then(move |x| async move {
delay_for(Duration::from_secs(some_time)).await;
x
})
It seems it's sometimes related to lifetimes of the closure. Sometimes you can work around that with a dedicated function on which you can set for<'a>, although nobody has posted an example of that I think.
In the last thread it seems to be related to Send.