I have a Foo trait inheriting from another attribute of Bar . Bar has a related type of Baz . Foo restricts Baz in such a way that Baz must implement Hoge .
trait Hoge {} trait Bar { type Baz; } trait Foo: Bar where Self::Baz: Hoge {}
However, when I define a generic function that requires a generic type T to implement Foo ,
rustc complains about EO277 if I don't restrict T explicitly:
fn fizz<T: Foo>(buzz: T) where T::Baz: Hoge {
I don’t understand why I need this. I would like to write [DESIRED CODE] . What is the recommended way to do this?
rust
Tsukki
source share