]> git.lizzy.rs Git - rust.git/commit - src/tools/clippy
Rollup merge of #69008 - Aaron1011:fix/opaque-ty-parent, r=matthewjasper
authorDylan DPC <dylan.dpc@gmail.com>
Thu, 13 Feb 2020 01:52:49 +0000 (02:52 +0100)
committerGitHub <noreply@github.com>
Thu, 13 Feb 2020 01:52:49 +0000 (02:52 +0100)
commite9f391e09a43680cfe24077ba750997eb3893ade
tree54b842d7610d1cd6fd92763c640de4f2f76bce6a
parent87ba8f2a19ef97790571a8b092b95fe87b6b6f76
parent34cf0b32674da79403746716e5a7ed2072dfabe2
Rollup merge of #69008 - Aaron1011:fix/opaque-ty-parent, r=matthewjasper

Properly use parent generics for opaque types

Fixes #67844

Previously, opaque types would only get parent generics if they
a return-position-impl-trait (e.g. `fn foo<A>() -> impl MyTrait<A>`).

However, it's possible for opaque types to be nested inside one another:

```rust
trait WithAssoc { type AssocType; }

trait WithParam<A> {}

type Return<A> = impl WithAssoc<AssocType = impl WithParam<A>>;
```

When this occurs, we need to ensure that the nested opaque types
properly inherit generic parameters from their parent opaque type.

This commit fixes the `generics_of` query to take the parent item
into account when determining the generics for an opaque type.
src/librustc_typeck/collect.rs