]> git.lizzy.rs Git - rust.git/commit - src/tools/clippy
Rollup merge of #62423 - Aaron1011:fix/existential-cycle, r=oli-obk
authorMazdak Farrokhzad <twingoow@gmail.com>
Sat, 27 Jul 2019 15:40:45 +0000 (17:40 +0200)
committerGitHub <noreply@github.com>
Sat, 27 Jul 2019 15:40:45 +0000 (17:40 +0200)
commit4b8031cf2cb6e7ebd738a68ecd79501dee791da7
tree79f1676edc419040604e8eda2653096dc1585b7c
parent0e9b465d729d07101b29b4d096d83edf9be82df0
parent2f4196205336df8550a4bfb3045d3d1c350f02bf
Rollup merge of #62423 - Aaron1011:fix/existential-cycle, r=oli-obk

Fix cycle error with existential types

Fixes #61863

We now allow uses of `existential type`'s that aren't defining uses - that is, uses which don't constrain the underlying concrete type.

To make this work correctly, we also modify `eq_opaque_type_and_type` to not try to apply additional constraints to an opaque type. If we have code like this:

```rust
existential type Foo;
fn foo1() -> Foo { ... }
fn foo2() -> Foo { foo1() }
```

then `foo2` doesn't end up constraining `Foo`, which means that `foo2` will end up using the type `Foo` internally - that is, an actual `TyKind::Opaque`. We don't want to equate this to the underlying concrete type - we just need to enforce the basic equality constraint between the two types (here, the return type of `foo1` and the return type of `foo2`)
src/librustc_mir/borrow_check/nll/type_check/mod.rs
src/librustc_typeck/check/writeback.rs