Skip to content

MIR Borrowck: two-phased borrows #46037

Closed
@nikomatsakis

Description

@nikomatsakis

For maximum impact of demo, we should support two-phased borrows. The general strategy here is to do this in borrow check. When we see a suitable &mut borrow (one tricky bit: deciding the set of &mut borrows for which to do this), we want to generate two loans, one of which is the "first phase" (reserved?) loan that acts as a shared borrow. This will be gen'd at the borrow site and killed at the first use of the temporary to which the borrow is assigned. The other loan will be gen'd at that first use site and killed as normal. This is a placeholder issue to ensure it is not forgotten, more description perhaps to come. =)

Metadata

Metadata

Assignees

Labels

T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions