Binding associated type requires redundancy. #40093
Labels
A-associated-items
Area: Associated items (types, constants & functions)
C-bug
Category: This is a bug.
T-lang
Relevant to the language team
Uh oh!
There was an error while loading. Please reload this page.
I've been told this may be intended behavior, in which case treat this as a vote for "I think it shouldn't be". :)
If you have a trait with a constraint on an associated type,
You can use the trait without constraints, like so
but if you instantiate any associated types it breaks.
You can solve the problem by copy/paste with the trait constraint.
I've been pointed at 28055, related to super traits (same, maybe not?). I think the invoked argument is that "too many inferred constraints leads to spooky action at a distance", which I understand.
At the moment, I very much feel like the maintainability trade-off is in totally the wrong direction, though. If this associated type changes, or goes away, or has a new constraint, all existing code that may not care about the type breaks until you copy/paste in the (I feel) redundant requirements the trait already imposes.
Edit: see also #34106.
The text was updated successfully, but these errors were encountered: