[Feature Request][move-compiler-v2] Lambda Lifting needs to handle modified free variables #13221
Labels
compiler-v2
enhancement
New feature or request
stale-exempt
Prevents issues from being automatically marked and closed as stale
馃殌 Feature Request
We can't enable lambda lifting because some of our tests have free variables in lambda functions.
To handle mutated free variables in lambdas, we do an additional prepass
that transforms turns modified free variables into use of a
&mut
free variable. A minimaltransformation is as follows:
after which, the lambda has no mutated free variables and can be replaced by Closure(lifted, ac).
Now, what borrow analysis can do with that remains to be seen. We may want to do something
special if the lambda already uses
&mut c
for free variablec
.The text was updated successfully, but these errors were encountered: