diff options
| author | Nixon Enraght-Moony <nixon.emoony@gmail.com> | 2022-09-13 18:34:15 +0100 |
|---|---|---|
| committer | Nixon Enraght-Moony <nixon.emoony@gmail.com> | 2022-09-13 18:34:15 +0100 |
| commit | e80ccd3d3aea9af8d3e0972d4f73f81a99fadfcd (patch) | |
| tree | 8935f968335f4177bae3314ca3160228a3c1b94a /src/librustdoc/json | |
| parent | 2e44c17c12cec45b6a682b1e53a04ac5b5fcc9d2 (diff) | |
| download | rust-e80ccd3d3aea9af8d3e0972d4f73f81a99fadfcd.tar.gz rust-e80ccd3d3aea9af8d3e0972d4f73f81a99fadfcd.zip | |
Rustdoc-Json: Don't loose subitems of foreign traits.
Diffstat (limited to 'src/librustdoc/json')
| -rw-r--r-- | src/librustdoc/json/mod.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/librustdoc/json/mod.rs b/src/librustdoc/json/mod.rs index 6a1409c7394..5e8f5f6fe3e 100644 --- a/src/librustdoc/json/mod.rs +++ b/src/librustdoc/json/mod.rs @@ -101,6 +101,7 @@ impl<'tcx> JsonRenderer<'tcx> { } fn get_trait_items(&mut self) -> Vec<(types::Id, types::Item)> { + debug!("Adding foreign trait items"); Rc::clone(&self.cache) .traits .iter() @@ -109,6 +110,7 @@ impl<'tcx> JsonRenderer<'tcx> { if !id.is_local() { let trait_item = &trait_item.trait_; for item in &trait_item.items { + trace!("Adding subitem to {id:?}: {:?}", item.item_id); self.item(item.clone()).unwrap(); } let item_id = from_item_id(id.into(), self.tcx); @@ -184,7 +186,9 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { /// the hashmap because certain items (traits and types) need to have their mappings for trait /// implementations filled out before they're inserted. fn item(&mut self, item: clean::Item) -> Result<(), Error> { - trace!("rendering {} {:?}", item.type_(), item.name); + let item_type = item.type_(); + let item_name = item.name; + trace!("rendering {} {:?}", item_type, item_name); // Flatten items that recursively store other items. We include orphaned items from // stripped modules and etc that are otherwise reachable. @@ -253,6 +257,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { } } + trace!("done rendering {} {:?}", item_type, item_name); Ok(()) } @@ -263,14 +268,20 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { fn after_krate(&mut self) -> Result<(), Error> { debug!("Done with crate"); + debug!("Adding Primitve impls"); for primitive in Rc::clone(&self.cache).primitive_locations.values() { self.get_impls(*primitive); } let e = ExternalCrate { crate_num: LOCAL_CRATE }; + // FIXME(adotinthevoid): Remove this, as it's not consistant with not + // inlining foreign items. + let foreign_trait_items = self.get_trait_items(); let mut index = (*self.index).clone().into_inner(); - index.extend(self.get_trait_items()); + index.extend(foreign_trait_items); + + debug!("Constructing Output"); // This needs to be the default HashMap for compatibility with the public interface for // rustdoc-json-types #[allow(rustc::default_hash_types)] |
