Fully qualified syntax for associated type of associated type

I have a trait that has an assocated type Ctx

trait BarTrait {
    type Ctx: PartialEq + Debug
    ....
}

and another trait that has an associated type Bar. Now I want to refer to FooTrait's associated type's associated type in a defined method (so BarTrait's Ctx type)

trait FooTrait {
    type Bar: BarTrait;

   fn load(ctx: Self::Bar::Ctx) -> Self;
}

When I compile this I get an error telling me to

help: use fully-qualified syntax: `<<Self as traits::FooTrait>::Bar as Trait>::Ctx`

However, when I do so, it then complains that Trait is an undeclared type or module..
So How do I go about doing this?

You can use <Self::Bar as BarTrait>::Ctx.

yep that did it.

Should have tried that instead of focusing on what the compiler was telling me.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.