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

Comments

Projects
None yet
4 participants
@nikomatsakis
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.)

@chrisvittal

This comment has been minimized.

Show comment
Hide comment
@chrisvittal

chrisvittal Sep 27, 2017

Contributor

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. 😞

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. 😞

bors added a commit that referenced this issue Oct 4, 2017

Auto merge of #44878 - Nashenas88:master, r=nikomatsakis
Store a new Region value every time we create a new region variable

Paired with @spastorino to walk through this and implement #44870.

bors added a commit that referenced this issue Oct 5, 2017

Auto merge of #44878 - Nashenas88:master, r=nikomatsakis
Store a new Region value every time we create a new region variable

Paired with @spastorino to walk through this and implement #44870.
@nikomatsakis

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

nikomatsakis Dec 1, 2017

Contributor

This is long since done.

Contributor

nikomatsakis commented Dec 1, 2017

This is long since done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment