]> git.lizzy.rs Git - rust.git/commit
rustdoc: Add support for associated items even outside the impl itself
authorJoshua Nelson <jyn514@gmail.com>
Sat, 18 Jul 2020 20:48:03 +0000 (16:48 -0400)
committerJoshua Nelson <jyn514@gmail.com>
Sat, 22 Aug 2020 04:25:28 +0000 (00:25 -0400)
commit42232ba70add056cf422960ac96986264870b313
tree7dc620d2855ca503beeca6845d0a1281bd2e1ea8
parenta97d65d6e474e86cad99cd833a5cd2ba32eb678f
rustdoc: Add support for associated items even outside the impl itself

Previously, associated items would only be available for linking
directly on the `impl Trait for Type`. Now they can be used anywhere.

- Make `item` for resolve mandatory
- Refactor resolving associated items into a separate function
- Remove broken trait_item logic
- Don't skip the type namespace for associated items
- Only call `variant_field` for `TypeNS`
- Add test for associated items
- Use exhaustive matches instead of wildcards

Wildcards caused several bugs while implementing this.
src/librustdoc/clean/types.rs
src/librustdoc/passes/collect_intra_doc_links.rs
src/test/rustdoc/intra-link-associated-defaults.rs [new file with mode: 0644]
src/test/rustdoc/intra-link-associated-items.rs [new file with mode: 0644]