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
Currently the compiler does no form of closure conversion. Code such as
let x = 2;let f = |y| x + y;f(3);
Is represented quite literally after monomorphization leading to functions in SSA referring to a closure's environment from outside of the function, without taking in the environment as a parameter. This leads to odd bugs such as #1088. The new ssa refactor is also more stringent and panics when a closure environment is used this way.
Proposed solution
Going forward we should implement proper closure conversion to solve both these issues. This means translating the above code into the following before/during monomorphisation:
let x = 2;let f = (x, |x2, y| x2 + y);
f.1(f.0,3);
Alternatives considered
No response
Additional context
No response
Submission Checklist
Once I hit submit, I will assign this issue to the Project Board with the appropriate tags.
The text was updated successfully, but these errors were encountered:
Problem
Currently the compiler does no form of closure conversion. Code such as
Is represented quite literally after monomorphization leading to functions in SSA referring to a closure's environment from outside of the function, without taking in the environment as a parameter. This leads to odd bugs such as #1088. The new ssa refactor is also more stringent and panics when a closure environment is used this way.
Proposed solution
Going forward we should implement proper closure conversion to solve both these issues. This means translating the above code into the following before/during monomorphisation:
Alternatives considered
No response
Additional context
No response
Submission Checklist
The text was updated successfully, but these errors were encountered: