diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-04-12 23:16:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-12 23:16:55 +0200 |
| commit | 0ec00c0ba3f2fdede6700af7b8f4438b5d7afebe (patch) | |
| tree | 6dc8f5eb77ef06300cdbe0a18214844f5a4e7a22 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 52ca603da73ae9eaddf96f77953b33ad8c47cc8e (diff) | |
| parent | 8de453a8c6a26e43876def2d757bec40ed9b2767 (diff) | |
| download | rust-0ec00c0ba3f2fdede6700af7b8f4438b5d7afebe.tar.gz rust-0ec00c0ba3f2fdede6700af7b8f4438b5d7afebe.zip | |
Rollup merge of #95316 - fmease:rustdoc-discr-req-prov-assoc-consts-tys, r=notriddle,GuillaumeGomez
Rustdoc: Discriminate required and provided associated constants and types
Currently, rustdoc merely separates required and provided associated _functions_ (i.e. methods). This PR extends this to constants (fixes #94652) and types. This makes the documentation of all three kinds of associated items more alike and consistent.
As an aside, associated types may actually be provided / have a default when users enable the unstable feature `associated_type_defaults`.
| Before | After |
|---|---|
|  |  |
|  |  |
### `clean::types::ItemKind` modification
* `ItemKind::TypedefItem(.., true)` → `ItemKind::AssocTypeItem(..)`
* `ItemKind::TypedefItem(.., false)` → `ItemKind::TypedefItem(..)`
Further, I added `ItemKind::TyAssoc{Const,Type}Item`, the “required” variant of `ItemKind::Assoc{Const,Type}Item`, analogous to `ItemKind::TyMethodItem` with `ItemKind::MethodItem`. These new variants don't contain new information really, they are just the result of me getting rid of the `Option<_>` field in `AssocConstItem` and `AssocTypeItem`.
**Goal**: Make associated items more consistent.
Originally I thought modifying `ItemKind` was necessary to achieve the new functionality of this PR but in retrospect, it does not. If you don't like the changes to `ItemKind`, I think I _can_ get rid of them.
This change is the root cause of those tiny changes in a lot of different files.
### Concerns and Open Questions
* **breaking changes** to hyperlinks: Some heading IDs change:
* `associated-const` (sic!) -> `{provided,required}-associated-consts`
* `associated-types` -> `{provided,required}-associated-types`
* **verbosity** of the headings _{Required,Provided} Associated {Constants,Types}_
* For some files, I am not sure if the changes I made are correct. So please take extra care when reviewing `conversions.rs` (conversion to JSON), `cache.rs`/`fold_item`, `stripper.rs`/`fold_item`, `check_doc_test_visibility.rs`/`should_have_doc_example`, `collect_intra_doc_links.rs`/`from_assoc_item`
* JSON output: I still map `AssocTypeItem`s to `Typedef` etc. (FIXME)
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
