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

propagate outlives between types and regions #22

Merged
merged 23 commits into from
Dec 7, 2017
Merged

Conversation

nikomatsakis
Copy link
Owner

This branch is targeting rust-lang#45826. I am running tests now but it seems to be at a consistent point and ready for merging.

Before, we would always have a `Some` ClosureRegionRequirements if we
were inferring values for a closure. Now we only do is it has a
non-empty set of outlives requirements.
This allows us to re-use the `normalize` method on `TypeCheck`, which
is important since normalization may create fresh region
variables. This is not an ideal solution, though, since the current
representation of "liveness constraints" (a vector of (region, point)
pairs) is rather inefficient. Could do somewhat better by converting
to indices, but it'd still be less good than the older code. Unclear
how important this is.
In the future, `check_type_tests` will also potentially propagate
constriants to its caller.
The existing flags did not consider `'static` to be "free". This then
fed into what was "erasable" -- but `'static` is most certainly
erasable.
Currently, we only propagate type tests that exclude all regions from
the type.
This is needed to allow the `ClosureRegionRequirements` to capture
types that include regions.
The input/output types found in `UniversalRegions` are not normalized.
The old code used to assign them directly into the MIR, which would
lead to errors when there was a projection in a argument or return
type. This also led to some special cases in the `renumber` code.

We now renumber uniformly but then pass the input/output types into
the MIR type-checker, which equates them with the types found in MIR.
This allows us to normalize at the same time.
Turns out this works but we had no test targeting it.
We don't need to know the vector of region bounds; we only care if
there were any region bounds at all.
@nikomatsakis nikomatsakis merged commit afa2e58 into nll-master Dec 7, 2017
@nikomatsakis
Copy link
Owner Author

merging this branch (all tests passed locally)

nikomatsakis pushed a commit that referenced this pull request Sep 16, 2019
declare EnvKey before use to fix build error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant