diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index fda9070305797..b72a5bbb7f981 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -627,7 +627,11 @@ crate fn from_macro_kind(kind: rustc_span::hygiene::MacroKind) -> MacroKind { impl FromWithTcx for Typedef { fn from_tcx(typedef: clean::Typedef, tcx: TyCtxt<'_>) -> Self { let clean::Typedef { type_, generics, item_type: _ } = typedef; - Typedef { type_: type_.into_tcx(tcx), generics: generics.into_tcx(tcx) } + Typedef { + type_: type_.into_tcx(tcx), + generics: generics.into_tcx(tcx), + impls: Vec::new(), // Added in JsonRenderer::item + } } } diff --git a/src/librustdoc/json/mod.rs b/src/librustdoc/json/mod.rs index 915a9fd2b894a..7cf500972fd29 100644 --- a/src/librustdoc/json/mod.rs +++ b/src/librustdoc/json/mod.rs @@ -171,6 +171,8 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { e.impls = self.get_impls(id.expect_def_id()) } else if let types::ItemEnum::Union(ref mut u) = new_item.inner { u.impls = self.get_impls(id.expect_def_id()) + } else if let types::ItemEnum::Typedef(ref mut t) = new_item.inner { + t.impls = self.get_impls(id.expect_def_id()) } let removed = self.index.borrow_mut().insert(from_item_id(id), new_item.clone()); @@ -236,7 +238,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { ) }) .collect(), - format_version: 7, + format_version: 8, }; let mut p = self.out_path.clone(); p.push(output.index.get(&output.root).unwrap().name.clone().unwrap()); diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs index 37cdc94441df7..8bbd431b927ec 100644 --- a/src/rustdoc-json-types/lib.rs +++ b/src/rustdoc-json-types/lib.rs @@ -494,6 +494,7 @@ pub struct Typedef { #[serde(rename = "type")] pub type_: Type, pub generics: Generics, + pub impls: Vec, } #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]