summary refs log tree commit diff
path: root/src/librustdoc/html/render
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2021-04-04 13:08:17 -0700
committerMichael Howell <michael@notriddle.com>2021-04-04 14:09:16 -0700
commit2370e3b439aa01982c33bbfe9823337a6231207f (patch)
tree7e541d5fc3c3961a247605e690d91e79241fe41e /src/librustdoc/html/render
parent5f92951d4ff91085ae7af62b2abf43fffde8b35d (diff)
downloadrust-2370e3b439aa01982c33bbfe9823337a6231207f.tar.gz
rust-2370e3b439aa01982c33bbfe9823337a6231207f.zip
Get rid of unneeded `aliases` field
Diffstat (limited to 'src/librustdoc/html/render')
-rw-r--r--src/librustdoc/html/render/cache.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/librustdoc/html/render/cache.rs b/src/librustdoc/html/render/cache.rs
index 022afee3105..2265905dcba 100644
--- a/src/librustdoc/html/render/cache.rs
+++ b/src/librustdoc/html/render/cache.rs
@@ -87,7 +87,11 @@ crate fn build_index<'tcx>(krate: &clean::Crate, cache: &mut Cache, tcx: TyCtxt<
         }
     }
 
-    let Cache { ref mut search_index, ref paths, ref mut aliases, .. } = *cache;
+    let Cache { ref mut search_index, ref paths, .. } = *cache;
+
+    // Aliases added through `#[doc(alias = "...")]`. Since a few items can have the same alias,
+    // we need the alias element to have an array of items.
+    let mut aliases: BTreeMap<String, Vec<usize>> = BTreeMap::new();
 
     // Sort search index items. This improves the compressibility of the search index.
     search_index.sort_unstable_by(|k1, k2| {
@@ -210,7 +214,7 @@ crate fn build_index<'tcx>(krate: &clean::Crate, cache: &mut Cache, tcx: TyCtxt<
             doc: crate_doc,
             items: crate_items,
             paths: crate_paths,
-            aliases,
+            aliases: &aliases,
         })
         .expect("failed serde conversion")
         // All these `replace` calls are because we have to go through JS string for JSON content.