rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.66k stars 12.75k forks source link

rustdoc: "Implementations on Foreign Types" does not work bidirectionally for non-std types #55434

Open joepie91 opened 6 years ago

joepie91 commented 6 years ago

While working with the embedded-hal crates for STM32 boards, I ran into a curious issue where the "Implementations on Foreign Types" section lists pretty much what it says on the tin, but the foreign types in question do not conversely list all the traits that are 'foreignly' implemented on them.

While understandable for std types, since the std library is externally documented and thus can't be modified to reflect this fact, this makes a lot less sense when eg. generating documentation for a project through cargo doc; and in fact, it can make it very difficult when working with svd2rust-based crates to determine what you can do with eg. GPIO pins.

I've reproduced a small testcase of the problem here: https://git.cryto.net/joepie91/rustdoc-foreign-traits-bugcase

The generated documentation is included, but can also be found here. You can see that the other::Foo trait has an impl Foo for Baz under implementations on foreign types, but conversely the Baz struct does not list the Foo trait anywhere.

Ideally, this should work bidirectionally, and the Foo trait should be listed on Baz (eg. as a 'foreignly implemented trait').

cargo 1.31.0-nightly (2d0863f65 2018-10-20)
release: 1.31.0
commit-hash: 2d0863f657e6f45159fc7412267eee3e659185e5
commit-date: 2018-10-20
joepie91 commented 6 years ago

Apologies, seems I forgot to actually push my testcase to the repository. That's fixed now.

lolbinarycat commented 1 week ago

triage: yep, this is still an issue