-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack overflow declaring mutually recursive traits #11824
Comments
There seems to have been no progress on this issue. Does anyone know what might be the source of the problem or what could be done to fix it? |
trait Hash<H: Hasher<Self>> {
fn f(&self, _: H) {}
}
trait Hasher<H: Hash<Self>> {
fn g(&self, _: H) {}
}
trait StreamHash<H: StreamHasher<Self>>: Hash<H> {
fn h(&self, _: H) {}
}
trait StreamHasher<H: StreamHash<Self>>: Hasher<H> {
fn i(&self, _: H) {}
}
fn main() {
} I updated the original code block to compile with the latest Rust. I had to add methods for each trait to avoid the compiler complaining about unused type parameters. Also had to add |
No longer reproducible. |
…Alexendoo Update rust-cache GHA in deploy workflow This action was way outdated, produced a lot of warnings and didn't seem to work anymore. changelog: none
This code causes rustc's stack to overflow:
As a workaround, you can break up the recursion with another trait:
The text was updated successfully, but these errors were encountered: