1
Fork 0

Don't call item on modules for json renderer

Closes #80664
This commit is contained in:
Nixon Enraght-Moony 2021-03-24 15:54:20 +00:00
parent ce21447c01
commit 9ba92972ed
7 changed files with 64 additions and 3 deletions

View file

@ -129,6 +129,8 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
"json"
}
const RUN_ON_MODULE: bool = false;
fn init(
krate: clean::Crate,
options: RenderOptions,
@ -169,8 +171,10 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
e.impls = self.get_impls(id)
}
let removed = self.index.borrow_mut().insert(from_def_id(id), new_item.clone());
// FIXME(adotinthevoid): Currently, the index is duplicated. This is a sanity check
// to make sure the items are unique.
// to make sure the items are unique. The main place this happens is when an item, is
// reexported in more than one place. See `rustdoc-json/reexport/in_root_and_mod`
if let Some(old_item) = removed {
assert_eq!(old_item, new_item);
}