Skip to content

Commit

Permalink
Add missing impls field to typedef
Browse files Browse the repository at this point in the history
  • Loading branch information
Urgau committed Sep 29, 2021
1 parent 50f9f78 commit 348ef7c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/librustdoc/json/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,11 @@ crate fn from_macro_kind(kind: rustc_span::hygiene::MacroKind) -> MacroKind {
impl FromWithTcx<clean::Typedef> 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
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/librustdoc/json/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down Expand Up @@ -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());
Expand Down
1 change: 1 addition & 0 deletions src/rustdoc-json-types/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ pub struct Typedef {
#[serde(rename = "type")]
pub type_: Type,
pub generics: Generics,
pub impls: Vec<Id>,
}

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

0 comments on commit 348ef7c

Please sign in to comment.