Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

model deferred borrows for nested method calls #3

Open
nikomatsakis opened this issue Jul 10, 2017 · 0 comments
Open

model deferred borrows for nested method calls #3

nikomatsakis opened this issue Jul 10, 2017 · 0 comments
Milestone

Comments

@nikomatsakis
Copy link
Owner

I think my preference would be to extend the & operator with a defer "attribute:"

x = #[defer] &foo;

As a pre-pass to the processing, we would compute the "deferred region" R_D by looking for the next use of x. The 'loans in scope' would then create two loan entries, one for the main loan, and one for the same point that is deferred. We would give the deferred loan the region R_D; the main loans would be generated at the first-uses (i.e., as we exit the region R_D).

We then have to modify also the pass which checks that each action is legal: in particular, issuing a loan when there is a deferred region in scope is only legal if the lifetime of the loan is a subset of the deferred region R_D.

@nikomatsakis nikomatsakis added this to the NLL-RFC milestone Jul 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant