-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Description
As part of #53488, we need to refactor code that relies on the freevars helper to figure out what things a closure captures. The freevars function just lists the "base variables" that a closure uses. This used to be equivalent to the sets of captures but that is what we are trying to change.
@blitzerr already introduced a new field to the TypeckTables, the upvar_list. This maps from each closure to the list of upvars captured by it. These upvars are identified by a UpvarId -- eventually, though, they will be expected to contain additional information, so that a closure like || foo(&x.y.z) might record that it captures x.y.z and not just x.
There is a list of freevars uses in this dropbox paper document. This issue should be extended with a list of the uses. I'll also add some mentoring instructions for specific cases to try and get things rolling.