-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.
Description
I tried this code: [playground]
pub trait Trait {}
pub trait WithAssoc {
type Assoc;
}
pub trait WithSizedAssoc: WithAssoc
where
Self::Assoc: Trait,
{
}
pub struct S<T: WithSizedAssoc>(T::Assoc);
I expected this to compile. Instead, it gives the following error:
error[[E0277]](https://doc.rust-lang.org/stable/error-index.html#E0277): the trait bound `<T as WithAssoc>::Assoc: Trait` is not satisfied
--> src/lib.rs:13:17
|
13 | pub struct S<T: WithSizedAssoc>(T::Assoc);
| ^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `<T as WithAssoc>::Assoc`
|
note: required by a bound in `WithSizedAssoc`
--> src/lib.rs:9:18
|
7 | pub trait WithSizedAssoc: WithAssoc
| -------------- required by a bound in this
8 | where
9 | Self::Assoc: Trait,
| ^^^^^ required by this bound in `WithSizedAssoc`
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
13 | pub struct S<T: WithSizedAssoc>(T::Assoc) where <T as WithAssoc>::Assoc: Trait;
| ++++++++++++++++++++++++++++++++++++
For more information about this error, try `rustc --explain E0277`.
Meta
playground 1.66.0-nightly (2022-10-21 5c8bff7)
KiruyaMomochi, Dante-Broggi, TimDiekmann and preston-evans98
Metadata
Metadata
Assignees
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.