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
In order to be a bit more specific, in Rust a closure is composed of two things: a function and an "environment". The environment contains all the local variables that were captured by the closures.
For example if you do let a = 5; move || a + 3 then the environment of the closure is the variable a.
In order to make this work, hlua asks lua to allocate some memory, copies the environment inside it, pushes the environment as a "hidden parameter" for the C callback, and when the C callback is called the environment is loaded and the closure is recreated.
However many closures and all freestanding functions don't have any environment at all. In this situation hlua still asks lua to allocate 0 byte of memory, pushes the hidden parameter, and when the C callback is called it asks lua to load the zero-sized data. This issue is about removing all these useless steps.
Very long term issue. Requires specialization to be stable and a way to specialize for functions and closures that don't borrow any environment.
The text was updated successfully, but these errors were encountered: