-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Bounds on associated types of super-traits not propagated #44656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
duplicate of #20671 |
@arielb1 I want to write a trait like this: pub trait Point: std::ops::Index<usize> where Self::Output: Float {}; but if I do that I need to repeat that where clause everywhere where I use the trait. If I could write my own index trait I would just do: pub trait Index<T> {
type Output: Float;
fn index...
} and then I can just require that and never have to write the bound. Is there a way to add that bound externally so that I don't have to repeat it everywhere? |
Not that I know of. The implied bounds RFC might improve the situation in the future - got to talk about that with @nikomatsakis . |
The following works: pub trait Point
: std::ops::Index<usize, Output = <Self as Point>::Output> {
type Output: Float;
} |
Uh oh!
There was an error while loading. Please reload this page.
MWE on the playground:
The text was updated successfully, but these errors were encountered: