Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait Super {}
- trait Sub: Super {}
- struct A<T> { a: T }
- struct B<T> { b: T }
- trait Trait { type SomeType; }
- impl<'a, T> A<T>
- where
- T: Trait,
- T::SomeType: Super,
- {
- fn some_type_is_super(&self) {}
- }
- //impl<'a, T> B<T> where T: Trait<SomeType = &'a Super> { // Works
- impl<T> B<T>
- where
- T: Trait,
- T::SomeType: Sub,
- { // Doesn't work
- fn some_type_is_sub(&self, a: A<T>) {
- // It should be possible to call "some_type_is_super" from `A` since
- // Sub has the `Super` trait bound. Why it doesn't work?
- let _ = a.some_type_is_super();
- }
- }
Add Comment
Please, Sign In to add comment