Inconsistency regarding inferring trait bounds of an associated type: this causes paradox when trying to generically implement the trait #116200
Labels
A-associated-items
Area: Associated items (types, constants & functions)
A-trait-system
Area: Trait system
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
This issue relates to implied trait bounds in trait definitions / impls. There maybe a wider issue / tracker issue this relates to. I've looked and don't think I can find a duplicate.
This probably falls somewhere under the tracker issue Extended Implied Trait Bounds.
I tried this code:
I expected the compiler to be consistent at all stages of the definition / use of the trait Foo (Ideally the compiler would imply trait bounds more globally here anyway)
i.e. either that first definition of
trait try_use_implied_trait_bounds::Foo { type Bar<T>: StoresItem<Item = T>}
which does not specifyT: Clone
would not compile / should be flagged as invalid by the compiler, because, as explained above, it cannot be implemented generically.or that, the impls of try_use_implied_trait_bounds::Foo on MyFoo* should imply T: Clone in some way or another.
See the comments in the code for details / explanation.
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: