nikomatsakis / borrowck

Modeling NLL and the Rust borrowck
Apache License 2.0
76 stars 11 forks source link

rework free-regions to be handled more specially #19

Closed nikomatsakis closed 7 years ago

nikomatsakis commented 7 years ago

This may not be the most elegant way to do it, but it was the quickest way I saw to get to a viable prototype. Free regions are still considered points in the CFG, but they are not connected to the normal CFG. Instead, during region inference, when we have an outlives relationship A: B @ P, if we find that the end of the function is reachable from P (within B), then we copy all skolemized-end points found in B into A. We also initialize the "inference variable" for free regions to contain the entire CFG + the appropriate skolemized end-point.

There is now error checking (I stole some of @Nashenas88's code for that). It works by designating the region variables that correspond to name regions as "capped", meaning that if the inference constraints would require them to grow, that results in an error. I also overhauled the error-reporting mechanism to be a bit cleaner.

More tests are desperately needed.

nikomatsakis commented 7 years ago

Gonna land this.