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

[NLL] store a value for each region #44870

Closed
nikomatsakis opened this issue Sep 26, 2017 · 2 comments
Closed

[NLL] store a value for each region #44870

nikomatsakis opened this issue Sep 26, 2017 · 2 comments
Labels
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

nikomatsakis commented Sep 26, 2017

The NLL code currently contains code to renumber all regions into fresh region variables, but it contains no map storing the value of those region variables.

We should define a struct Region that will store the value of a non-lexical region. This struct would resemble Region from the NLL prototype and basically play the same role. I think it can initially look something like this:

#[derive(Clone, Debug, Default, Hash, PartialEq, Eq)]
struct Region {
    points: FxHashSet<Location>,
}

The Location struct is defined in librustc/mir and it is basically a "point" -- basic block + statement index.

Then we should add to the NLLVisitor struct a field like region_values: Vec<Region>. Each time that we create a new region variable, we will also push a Region::default() onto the vector to serve as its (initially empty) value.

Eventually, this struct will also want to contain free regions. but I figure we can start without them, while we debate how best to represent free regions here. (Probably ty::Region<'tcx> for now, but I think we can ignore it for now and just target "intra-function" cases.)

@nikomatsakis nikomatsakis added 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. labels Sep 26, 2017
@chrisvittal
Copy link
Contributor

chrisvittal commented Sep 27, 2017

I am interested in working on this! It looks like that for now, all the work will be done in librustc_mir/transform/nll/mod.rs (once that PR is merged)?

Edit:
Never mind someone else already made a PR for this. 😞

@TimNN TimNN added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. and removed C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. labels Oct 1, 2017
bors added a commit that referenced this issue Oct 5, 2017
Store a new Region value every time we create a new region variable

Paired with @spastorino to walk through this and implement #44870.
@nikomatsakis
Copy link
Contributor Author

This is long since done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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