-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call 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.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
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.
Metadata
Metadata
Assignees
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call 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.Relevant to the compiler team, which will review and decide on the PR/issue.