-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make async futures Unpin
if they don't borrow anything across .await
s
#82187
Comments
This seems like it would cause problems regarding accidental breaking changes. Changing a function to now borrow something across an await point is an incredibly easy change to accidentally make and would result in the An alternative would be to make it possible to explicitly mark that an async function/block should be |
@JakobDegen I don't see how |
How about doing this only for |
You mean by making it a regular |
Yes, and I agree that could be annoying (sorry for not thinking of this point before commenting, stability itself is annoying)... |
I guess I'll create that then 😄 |
The amount of code required is smaller than I expected. I've hardly tested it, but I think it should work: https://docs.rs/async_auto_traits/0.1 |
(Off-topic content removed) It turns out that my suggestion has a breaking change hole because |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Okay, let's move this discussion to an issue on https://github.com/jplatte/async_auto_traits. @hyd-dev I suggest hiding your previous two comments here. |
Closing this as it's better tracked in the jplatte/async_auto_traits#1 issue, and it is better to have it contained in one issue instead of having 2 issues tracking it in different places |
@Dylan-DPC I think you misunderstood something, that is about preventing the leak of auto-traits of |
I was experimenting today with replacing the likes of |
Am I missing something or could rustc in principle make the anonymous (return) type of
async fn
andasync {}
blocks implementUnpin
(or maybe it should be "not implement!Unpin
") if the body does not contain any borrows across.await
points? I couldn't find an existing issue about this.The text was updated successfully, but these errors were encountered: