Why are supertraits weird?

Why does the first compile and the second not?

I have two traits and i want one to require the first. The first trait requires for the type to implement IntoIterator for &Self (not Self, so that i can use iter() or implement it later for all T that have that trait). But I have to specify again where for<'a> &'a Self: IntoIterator, in the second trait.
Since i have other traits that require the basic trait I dont want to clutter all the code with bounds that are required in some mod far from the actual code.

1 Like

the short answer is the where clause of &'a Self is not a super trait, so it is not propagated.

see also discussion in this previous post:

4 Likes

Thank you, searching for this stuff is hard, probably needs to be written somewhere on the wiki.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.