Skip to content

refactor uses of freevars to use the upvar list #60205

Closed
@nikomatsakis

Description

@nikomatsakis

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.

There is a Zulip topic for discussion of this issue.

Metadata

Metadata

Assignees

Labels

E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions