Skip to content

Commit

Permalink
Get rid of unneeded aliases field
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle committed Apr 4, 2021
1 parent 5f92951 commit 2370e3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/librustdoc/formats/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ crate struct Cache {
// when gathering trait documentation on a type, hold impls here while
// folding and add them to the cache later on if we find the trait.
orphan_trait_impls: Vec<(DefId, FxHashSet<DefId>, Impl)>,

/// 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.
crate aliases: BTreeMap<String, Vec<usize>>,
}

/// This struct is used to wrap the `cache` and `tcx` in order to run `DocFolder`.
Expand Down
8 changes: 6 additions & 2 deletions src/librustdoc/html/render/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 2370e3b

Please sign in to comment.