intra-doc: Use the impl's assoc item where possible by camelid · Pull Request #92680 · rust-lang/rust (original) (raw)

Before, the trait's associated item would be used. Now, the impl's
associated item is used. The only exception is for impls that use
default values for associated items set by the trait. In that case,
the trait's associated item is still used.

As an example of the old and new behavior, take this code:

trait MyTrait {
    type AssocTy;
}

impl MyTrait for String {
    type AssocTy = u8;
}

Before, when resolving a link to String::AssocTy,
resolve_associated_trait_item would return the associated item for
MyTrait::AssocTy. Now, it would return the associated item for
<String as MyTrait>::AssocTy, as it claims in its docs.

r? @petrochenkov