Skip to content
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

Move async function arguments into spawned futures #3043

Merged
merged 1 commit into from
Aug 30, 2022

Conversation

Liamolucko
Copy link
Collaborator

Fixes #3042

Previously, any exported async functions which borrowed their arguments would fail to compile, because the values being referenced are stored on the stack of the initial synchronous call and then dropped, leaving nothing for the spawned future to reference.

This moves the referenced values into the spawned future, fixing that.

Fixes rustwasm#3042

Previously, any exported async functions which borrowed their arguments would fail to compile, because the values being referenced are stored on the stack of the initial synchronous call and then dropped, leaving nothing for the spawned future to reference.

This moves the referenced values into the spawned future, fixing that.
@alexcrichton alexcrichton merged commit b2f9e12 into rustwasm:main Aug 30, 2022
@Liamolucko Liamolucko deleted the async-references branch August 30, 2022 05:25
zimond pushed a commit to zimond/wasm-bindgen that referenced this pull request Nov 17, 2022
Fixes rustwasm#3042

Previously, any exported async functions which borrowed their arguments would fail to compile, because the values being referenced are stored on the stack of the initial synchronous call and then dropped, leaving nothing for the spawned future to reference.

This moves the referenced values into the spawned future, fixing that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generated code for async functions in structs doesn't compile
2 participants