about summary refs log tree commit diff
path: root/src/librustdoc/html/render
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2022-05-26 14:01:08 -0700
committerMichael Howell <michael@notriddle.com>2022-05-26 14:40:48 -0700
commit767719cc304e9b025875aea073f66ce248ae2616 (patch)
tree1f679394195a5ac22136b3ed077626cff74b8bd0 /src/librustdoc/html/render
parentc516ffa8e531290687b60bb8023fbccd3abe43ad (diff)
downloadrust-767719cc304e9b025875aea073f66ce248ae2616.tar.gz
rust-767719cc304e9b025875aea073f66ce248ae2616.zip
rustdoc: factor orphan impl items into an actual struct
Diffstat (limited to 'src/librustdoc/html/render')
-rw-r--r--src/librustdoc/html/render/search_index.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/librustdoc/html/render/search_index.rs b/src/librustdoc/html/render/search_index.rs
index 323c0e89f29..dcdf18978e3 100644
--- a/src/librustdoc/html/render/search_index.rs
+++ b/src/librustdoc/html/render/search_index.rs
@@ -8,7 +8,7 @@ use serde::ser::{Serialize, SerializeStruct, Serializer};
 
 use crate::clean;
 use crate::clean::types::{FnRetTy, Function, GenericBound, Generics, Type, WherePredicate};
-use crate::formats::cache::Cache;
+use crate::formats::cache::{Cache, OrphanImplItem};
 use crate::formats::item_type::ItemType;
 use crate::html::format::join_with_double_colon;
 use crate::html::markdown::short_markdown_summary;
@@ -25,8 +25,10 @@ pub(crate) fn build_index<'tcx>(
 
     // Attach all orphan items to the type's definition if the type
     // has since been learned.
-    for &(did, ref item, ref impl_generics, from_blanket_or_auto_impl) in &cache.orphan_impl_items {
-        if let Some(&(ref fqp, _)) = cache.paths.get(&did) {
+    for &OrphanImplItem { parent, ref item, ref impl_generics, parent_is_blanket_or_auto_impl } in
+        &cache.orphan_impl_items
+    {
+        if let Some(&(ref fqp, _)) = cache.paths.get(&parent) {
             let desc = item
                 .doc_value()
                 .map_or_else(String::new, |s| short_markdown_summary(&s, &item.link_names(cache)));
@@ -35,13 +37,13 @@ pub(crate) fn build_index<'tcx>(
                 name: item.name.unwrap().to_string(),
                 path: join_with_double_colon(&fqp[..fqp.len() - 1]),
                 desc,
-                parent: Some(did),
+                parent: Some(parent),
                 parent_idx: None,
                 search_type: get_function_type_for_search(
                     item,
                     tcx,
                     impl_generics.as_ref(),
-                    from_blanket_or_auto_impl,
+                    parent_is_blanket_or_auto_impl,
                     cache,
                 ),
                 aliases: item.attrs.get_doc_aliases(),