]> git.lizzy.rs Git - rust.git/commitdiff
Merge #1895
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>
Sun, 22 Sep 2019 22:01:38 +0000 (22:01 +0000)
committerGitHub <noreply@github.com>
Sun, 22 Sep 2019 22:01:38 +0000 (22:01 +0000)
1895: Handle associated type shorthand (`T::Item`) (Second attempt) r=flodiebold a=flodiebold

This is only allowed for generic parameters (including `Self` in traits), and
special care needs to be taken to not run into cycles while resolving it,
because we use the where clauses of the generic parameter to find candidates for
the trait containing the associated type, but the where clauses may themselves
contain instances of short-hand associated types.

In some cases this is even fine, e.g. we might have `T: Trait<U::Item>, U:
Iterator`. If there is a cycle, we'll currently panic, which isn't great, but
better than overflowing the stack...

Co-authored-by: Florian Diebold <flodiebold@gmail.com>

Trivial merge