The deriving code scans the field types in order to generate bounds on associated types, if they happen to be used as a field type (this isn't foolproof but it catches a lot of cases).
The comment in this code implies that field: T::Assoc and field: <T as Trait>::Assoc would both work. However, the second one is missed and the required bound is not generated, resulting in a type error:
#[derive(Debug)]
struct Foo<T: FromStr> {
field: <T as FromStr>::Err
}
error[E0277]: `<T as std::str::FromStr>::Err` doesn't implement `std::fmt::Debug`
--> expr.rs:18:77
|
18 | field: <T as FromStr>::Err
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `<T as std::str::FromStr>::Err` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
= help: the trait `std::fmt::Debug` is not implemented for `<T as std::str::FromStr>::Err`
= help: consider adding a `where <T as std::str::FromStr>::Err: std::fmt::Debug` bound
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&<T as std::str::FromStr>::Err`
= note: required for the cast to the object type `std::fmt::Debug`
The deriving code scans the field types in order to generate bounds on associated types, if they happen to be used as a field type (this isn't foolproof but it catches a lot of cases).
https://github.com/rust-lang/rust/blob/9fae1537462bb10fd17d07816efc17cfe4786806/src/libsyntax_ext/deriving/generic/mod.rs#L350-L352
The comment in this code implies that
field: T::Assoc
andfield: <T as Trait>::Assoc
would both work. However, the second one is missed and the required bound is not generated, resulting in a type error:cc #26925.