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
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
stdtypes, since thestdlibrary 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 throughcargo doc; and in fact, it can make it very difficult when working withsvd2rust-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::Footrait has animpl Foo for Bazunder implementations on foreign types, but conversely theBazstruct does not list theFootrait anywhere.Ideally, this should work bidirectionally, and the
Footrait should be listed onBaz(eg. as a 'foreignly implemented trait').