-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-trait-systemArea: Trait systemArea: Trait systemT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
The following code works fine:
trait Upgr<S> {}
trait Proto {
type S;
type Upgr: Upgr<Self::S>;
}
struct Wrapper<P>(P);
impl<P: Proto> Proto for Wrapper<P> {
type S = P::S;
type Upgr = P::Upgr;
}
However if you change the last few lines for this:
impl<X, P: Proto<S = X>> Proto for Wrapper<P> {
type S = P::S;
type Upgr = P::Upgr;
}
Then you get:
error[E0277]: the trait bound
<P as Proto>::Upgr: Upgr<X>
is not satisfied
Using type S = X;
also doesn't work.
Rust version: nightly.
Apologize if an issue already exists. The vocabulary for this kind of problems is kind of tricky, which makes it hard to search for existing issues.
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-trait-systemArea: Trait systemArea: Trait systemT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.