The associated type used was not defined in the trait.
Erroneous code example:
#![allow(unused)]fnmain() {
traitT1 {
typeBar;
}
typeFoo = T1<F=i32>; // error: associated type `F` not found for `T1`// or:traitT2 {
typeBar;
// error: Baz is used but not declaredfnreturn_bool(&self, _: &Self::Bar, _: &Self::Baz) -> bool;
}
}
ⓘ
Make sure that you have defined the associated type in the trait body.
Also, verify that you used the right trait or you didn't misspell the
associated type name. Example:
#![allow(unused)]fnmain() {
traitT1 {
typeBar;
}
typeFoo = T1<Bar=i32>; // ok!// or:traitT2 {
typeBar;
typeBaz; // we declare `Baz` in our trait.// and now we can use it here:fnreturn_bool(&self, _: &Self::Bar, _: &Self::Baz) -> bool;
}
}