]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Auto merge of #65232 - nikomatsakis:lazy-norm-anon-const-push-2, r=matthewjasper
authorbors <bors@rust-lang.org>
Fri, 7 Feb 2020 23:08:52 +0000 (23:08 +0000)
committerbors <bors@rust-lang.org>
Fri, 7 Feb 2020 23:08:52 +0000 (23:08 +0000)
commit8498c5f5b02dbb4ed58a1eb4901b0b733342c35f
treef9c52c26c185f50112ce9a318e6c6fe173a3cc1a
parenta29424a2265411dda7d7446516ac5fd7499e2b55
parent4b3c66d2c309a16d48c2b7f992a2038016a098d3
Auto merge of #65232 - nikomatsakis:lazy-norm-anon-const-push-2, r=matthewjasper

replace the leak check with universes, take 2

This PR is an attempt to revive the "universe-based region check", which is an important step towards lazy normalization. Unlike before, we also modify the definition of `'empty` so that it is indexed by a universe. This sidesteps some of the surprising effects we saw before -- at the core, we no longer think that `exists<'a> { forall<'b> { 'b: 'a } }` is solveable. The new region lattice looks like this:

```
static ----------+-----...------+       (greatest)
|                |              |
early-bound and  |              |
free regions     |              |
|                |              |
scope regions    |              |
|                |              |
empty(root)   placeholder(U1)   |
|            /                  |
|           /         placeholder(Un)
empty(U1) --         /
|                   /
...                /
|                 /
empty(Un) --------                      (smallest)
```
This PR has three effects:

* It changes a fair number of error messages, I think for the better.
* It fixes a number of bugs. The old algorithm was too conservative and caused us to reject legal subtypings.
* It also causes two regressions (things that used to compile, but now do not).
    * `coherence-subtyping.rs` gets an additional error. This is expected.
    * `issue-57639.rs` regresses as before, for the reasons covered in #57639.

Both of the regressions stem from the same underlying property: without the leak check, the instantaneous "subtype" check is not able to tell whether higher-ranked subtyping will succeed or not. In both cases, we might be able to fix the problem by doing a 'leak-check like change' at some later point (e.g., as part of coherence).

This is a draft PR because:

* I didn't finish ripping out the leak-check completely.
* We might want to consider a crater run before landing this.
* We might want some kind of design meeting to cover the overall strategy.
* I just remembered I never finished 100% integrating this into the canonicalization code.
* I should also review what happens in NLL region checking -- it probably still has a notion of bottom (empty set).

r? @matthewjasper
src/librustc/infer/opaque_types/mod.rs
src/librustc/ty/context.rs
src/librustc/ty/structural_impls.rs
src/librustc/ty/sty.rs
src/librustc_session/lint/builtin.rs
src/librustc_typeck/collect.rs