Skip to content

Pass simple args to the closure and preserve their types

This change helps to preserve lifetime relationships between input and output that would be lost if we relied on closure capture to access variables. However, there are certain types of parameters that are impossible (argument position impl Trait) or difficult (pattern-matched structs) to forward to the closure. These are omitted from the closure's signature and captured just like they were before.

This also requires rewriting the closure body to change any references to self to a newly created variable this__. This is because self is not a legal parameter name inside a closure.

See test cases for the rationale. Should help with #11. Includes !4 (closed).

Merge request reports

Loading