Closed
Description
This code causes rustc's stack to overflow:
trait Hash<H: Hasher> { }
trait Hasher<H: Hash> { }
trait StreamHash<H: StreamHasher>: Hash<H> { }
trait StreamHasher<H: StreamHash>: Hasher<H> { }
fn main() {
}
As a workaround, you can break up the recursion with another trait:
trait Hash { }
trait Hasher<H: Hash> { }
trait Stream { }
trait StreamHash<S: Stream>: Hash { }
trait StreamHasher<H: StreamHash<Self>>: Stream + Hasher<H> { }
fn main() { }