Closed
Description
When synthesizing foreign traits, we don't recover the docs (among other things)
rust/src/librustdoc/json/mod.rs
Lines 118 to 141 in 8a09420
Meaning that for code:
// --- src/test/rustdoc-json/reexport/synthesize_trait_with_docs.rs ---
// aux-build: trait_with_docs.rs
extern crate trait_with_docs;
pub struct Local;
impl trait_with_docs::HasDocs for Local {}
// --- src/test/rustdoc-json/reexport/auxiliary/trait_with_docs.rs ---
/// The Docs
pub trait HasDocs {}
Produces
{
"crate_version": null,
"external_crates": { ... },
"format_version": 23,
"includes_private": false,
"index": {
"0:0:1568": {
"crate_id": 0,
"docs": null,
"id": "0:0:1568",
"inner": {"is_crate": true, "is_stripped": false, "items": ["0:4:1566"]},
"kind": "module",
"links": {},
"name": "synthesise_trait_with_docs"
},
"0:4:1566": {
"crate_id": 0,
"docs": null,
"id": "0:4:1566",
"inner": {
"generics": {"params": [], "where_predicates": []},
"impls": [ ..., "0:6" ],
"kind": "unit"
},
"kind": "struct",
"links": {},
"name": "Local"
},
"0:6": {
"crate_id": 0,
"docs": null,
"id": "0:6",
"inner": {
"blanket_impl": null,
"for": {
"inner": {"id": "0:4:1566", "name": "Local"},
"kind": "resolved_path"
},
"generics": {"params": [], "where_predicates": []},
"is_unsafe": false,
"items": [],
"negative": false,
"provided_trait_methods": [],
"synthetic": false,
"trait": {"id": "20:3:1567", "name": "HasDocs"}
},
"kind": "impl",
"links": {},
"name": null
},
"20:3:1567": {
"crate_id": 20,
"docs": null,
"id": "20:3:1567",
"inner": {
"bounds": [],
"generics": {"params": [], "where_predicates": []},
"implementations": [],
"is_auto": false,
"is_unsafe": false,
"items": []
},
"kind": "trait",
"links": {},
"name": "HasDocs"
}
},
"paths": {
"0:0:1568": {"crate_id": 0, "kind": "module", "path": ["synthesise_trait_with_docs"]},
"0:4:1566": {"crate_id": 0, "kind": "struct", "path": ["synthesise_trait_with_docs", "Local"]},
"20:0:1565": {"crate_id": 20, "kind": "module", "path": ["trait_with_docs"]},
"20:3:1567": {"crate_id": 20, "kind": "trait", "path": ["trait_with_docs", "HasDocs"]}
},
"root": "0:0:1568"
}
Where the docs for 20:3:1567
are null.
Either foreign trait syntesis should be done correctly, or not at all, and let users resolve via paths
@rustbot modify labels: +A-rustdoc-json +T-rustdoc