You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The important part here is that .is_deactivated takes a borrowed UserId type, which is taken across await boundaries with the subsequent .await
However, rust complains about this...
error: lifetime may not live long enough
--> src/database/rooms.rs:802:36
|
802 | .filter(move |user_id| Box::pin(async move {!db.users.is_deactivated(user_id).await.unwrap_or(false)}))
| -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2`
| | |
| | return type of closure `Pin<Box<impl futures::Future>>` contains a lifetime `'2`
| has type `&'1 ruma::UserId`
...because the filter function signature doesn't explicitly specify the borrow lifetime as OK to be used for a little while longer;
I have this following call on a stream, to filter out elements asynchronously (sorry for the ugly encapsulation, async closures aren't a thing yet);
The important part here is that
.is_deactivated
takes a borrowedUserId
type, which is taken acrossawait
boundaries with the subsequent.await
However, rust complains about this...
...because the
filter
function signature doesn't explicitly specify the borrow lifetime as OK to be used for a little while longer;I think that altering it to this fixes it, but i'm not sure how that counts with API cleanliness and lifetime soundness;
Quickly inserting this seems to pop up a lot of other issues, so i'm only going to report this issue for now here.
The text was updated successfully, but these errors were encountered: