Skip to content

Commit 348ef7c

Browse files
committed
Add missing impls field to typedef
1 parent 50f9f78 commit 348ef7c

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/librustdoc/json/conversions.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,11 @@ crate fn from_macro_kind(kind: rustc_span::hygiene::MacroKind) -> MacroKind {
627627
impl FromWithTcx<clean::Typedef> for Typedef {
628628
fn from_tcx(typedef: clean::Typedef, tcx: TyCtxt<'_>) -> Self {
629629
let clean::Typedef { type_, generics, item_type: _ } = typedef;
630-
Typedef { type_: type_.into_tcx(tcx), generics: generics.into_tcx(tcx) }
630+
Typedef {
631+
type_: type_.into_tcx(tcx),
632+
generics: generics.into_tcx(tcx),
633+
impls: Vec::new(), // Added in JsonRenderer::item
634+
}
631635
}
632636
}
633637

src/librustdoc/json/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
171171
e.impls = self.get_impls(id.expect_def_id())
172172
} else if let types::ItemEnum::Union(ref mut u) = new_item.inner {
173173
u.impls = self.get_impls(id.expect_def_id())
174+
} else if let types::ItemEnum::Typedef(ref mut t) = new_item.inner {
175+
t.impls = self.get_impls(id.expect_def_id())
174176
}
175177
let removed = self.index.borrow_mut().insert(from_item_id(id), new_item.clone());
176178

@@ -236,7 +238,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
236238
)
237239
})
238240
.collect(),
239-
format_version: 7,
241+
format_version: 8,
240242
};
241243
let mut p = self.out_path.clone();
242244
p.push(output.index.get(&output.root).unwrap().name.clone().unwrap());

src/rustdoc-json-types/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ pub struct Typedef {
494494
#[serde(rename = "type")]
495495
pub type_: Type,
496496
pub generics: Generics,
497+
pub impls: Vec<Id>,
497498
}
498499

499500
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]

0 commit comments

Comments
 (0)