-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Description
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.)