Skip to content

prototype NLL inference infrastructure #44904

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

Closed
nikomatsakis opened this issue Sep 28, 2017 · 3 comments
Closed

prototype NLL inference infrastructure #44904

nikomatsakis opened this issue Sep 28, 2017 · 3 comments
Labels
A-NLL Area: Non-lexical lifetimes (NLL) E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@nikomatsakis
Copy link
Contributor

Building on #44878,

In the nascent NLL code, we need to define the inference infrastructure. This is basically the code embodied by infer.rs in the prototype. In particular, this inference context ought to take ownership of the region values that were added in #44878. It would then also collect a series of constraints. In the prototype, those constraints take two forms:

  • Liveness constraints, which basically just insert a single point into a region. In the prototype, these are inserted directly into the value for the region as soon as the constraint is added. In the RFC, these are expressed in terms of outlives constraints that relate a region variable R to a singleton region (e.g., R: {P} @ P).
  • Outlives constraints, which relate two region variables at a particular point. In the prototype, these are accumulated into a vector. The solve routine then propagates values between variables according to these constraints.

In the prototype, everything is a region variable, but some variables can capped, which means that it is an error if they grow. Effectively those variables then become constants. We might want to code things up a bit differently, so that outlives constraints can encode constants as well. In particular, this is needed to report hard errors relating to free regions.

@nikomatsakis nikomatsakis added A-NLL Area: Non-lexical lifetimes (NLL) E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-incr-comp Working group: Incremental compilation labels Sep 28, 2017
@spastorino
Copy link
Member

Cool, I will start working on this one.

@michaelwoerister michaelwoerister added WG-compiler-nll and removed WG-incr-comp Working group: Incremental compilation labels Sep 29, 2017
@nikomatsakis
Copy link
Contributor Author

In progress PR: #45155

@nikomatsakis
Copy link
Contributor Author

Long since done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-NLL Area: Non-lexical lifetimes (NLL) E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants