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

Fix incorrect unboxed closure-related assert in trans #18730

Merged
merged 2 commits into from
Nov 9, 2014

Conversation

bkoropoff
Copy link
Contributor

FnOnce environments that fit within an int are passed to the closure by value. For some reason there was an assert that this would only happen if there were 1 or 0 free variables, but it can also happen if there are multiple variables that happen to fit.

Closes #18652

As an optimization, once unboxed closures receive their environment by
value if it fits within the size of an `int`.  An assert in this code
path assumed that this would only occur if the environment had no more
than a single free variable in it, but multiple smaller free variables
can easily be packed into the space of an `int`, particularly if any
of them are 0-sized.  The assert can simply be removed.

Closes rust-lang#18652
@bkoropoff
Copy link
Contributor Author

I'm fairly certain this change didn't cause the core dump. Needs a retry.

bors added a commit that referenced this pull request Nov 8, 2014
`FnOnce` environments that fit within an `int` are passed to the closure by value.  For some reason there was an assert that this would only happen if there were 1 or 0 free variables, but it can also happen if there are multiple variables that happen to fit.

Closes #18652
@bors bors closed this Nov 9, 2014
@bors bors merged commit 2c956d0 into rust-lang:master Nov 9, 2014
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.

ICE with move FnOnce unboxed closure
3 participants