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

Fixing panic if the Future wakes up after returning Poll::Ready #1598

Merged
merged 1 commit into from
Jun 17, 2019

Conversation

Pauan
Copy link
Contributor

@Pauan Pauan commented Jun 15, 2019

Some things like futures::channel::mpsc::UnboundedSender will trigger wakeups after returning Poll::Ready, so this fixes it so it ignores the spurious wakeups, rather than panicking.

The diff looks scary, but it's really just a tiny bit of reorganization (changing future.as_mut().unwrap_throw() into if let Some(future) = borrow.as_mut() { ... })

It looks a lot less scary if you disable whitespace in the diffs.

@alexcrichton alexcrichton merged commit b5da08c into rustwasm:master Jun 17, 2019
@alexcrichton
Copy link
Contributor

Good catch!

@Pauan Pauan deleted the fix-futures branch June 17, 2019 14:37
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.

2 participants