Repository navigation
rustdoc-json: impl dyn Trait gets discarded #133719
Copy link
Copy link
Open
Labels
A-dyn-traitArea: trait objects, vtable layoutArea: trait objects, vtable layoutA-rustdoc-jsonArea: Rustdoc JSON backendArea: Rustdoc JSON backendC-bugCategory: This is a bug.Category: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Description
Activity
- addedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on Dec 1, 2024 - addedT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.A-rustdoc-jsonArea: Rustdoc JSON backendArea: Rustdoc JSON backendand removedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on Dec 1, 2024 I'd expect a few things to happen in the rustdoc JSON here:
- an
implitem corresponding to theimpl dyn T1block - that
implitem containing anumber_plus_onefunction ("method") item - some form of "relationship" from
T1toimpl dyn T1, which isn't theimplementationsfield but something else.
Ideally, the approach would rhyme with how we represent other edge cases like
impl .. for &mut:pub trait T1 {} struct Example; impl T1 for Example {} // This impl is unrelated to the one above, and isn't technically on `Example`! // And yet it's related to `Example` so it probably should be linked // from the `Example` item in some manner. impl T1 for &mut Example {}
Reacted by Noah Lev and Yuxuan Shui- an
- added a commit that references this issue
on Dec 2, 2024 - addedA-dyn-traitArea: trait objects, vtable layoutArea: trait objects, vtable layoutC-bugCategory: This is a bug.Category: This is a bug.
on Dec 6, 2024
Metadata
Metadata
Assignees
Labels
A-dyn-traitArea: trait objects, vtable layoutArea: trait objects, vtable layoutA-rustdoc-jsonArea: Rustdoc JSON backendArea: Rustdoc JSON backendC-bugCategory: This is a bug.Category: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
For the following code:
generates
{ "format_version": 36, "includes_private": false, "index": { "0": { "attrs": [], "crate_id": 0, "deprecation": null, "docs": null, "id": 0, "inner": {"function": { ... }}, "name": "number", "visibility": "default" }, "1": { "attrs": [], "crate_id": 0, "deprecation": null, "docs": null, "id": 1, "inner": { "trait": { "bounds": [], "generics": {"params": [], "where_predicates": []}, "implementations": [], "is_auto": false, "is_dyn_compatible": true, "is_unsafe": false, "items": [0] } }, "name": "T1", "visibility": "public" }, "2": { "attrs": [], "crate_id": 0, "deprecation": null, "docs": null, "id": 2, "inner": {"module": {"is_crate": true, "is_stripped": false, "items": [1]}}, "name": "on_dyn_trait", "visibility": "public" } }, "root": 2 }(full).
There's nothing included for the
number_plus_onemethod, but there should be.The HTML backend get this right, so the releavent info is availible in
clean:I'm not sure what's the best way to store this is in the format: Putting it into the
implementationsfield seems wrong, asimpl dyn T1isn't an implementation ofT1, but an implementation ondyn T1. I'd love to hear people's thoughts on this.