Skip to content

Commit

Permalink
Add rustdoc hack
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Mar 22, 2024
1 parent 0aa7650 commit 4310040
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/librustdoc/html/render/search_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ pub(crate) fn build_index<'tcx>(
// Sort search index items. This improves the compressibility of the search index.
cache.search_index.sort_unstable_by(|k1, k2| {
// `sort_unstable_by_key` produces lifetime errors
let k1 = (&k1.path, k1.name.as_str(), &k1.ty, &k1.parent.map(|id| tcx.def_path_str(id)));
let k2 = (&k2.path, k2.name.as_str(), &k2.ty, &k2.parent.map(|id| tcx.def_path_str(id)));
// HACK(rustdoc): should not be sorting `CrateNum` or `DefIndex`, this will soon go away, too
let k1 = (&k1.path, k1.name.as_str(), &k1.ty, k1.parent.map(|id| (id.index, id.krate)));
let k2 = (&k2.path, k2.name.as_str(), &k2.ty, k2.parent.map(|id| (id.index, id.krate)));
Ord::cmp(&k1, &k2)
});

Expand Down

0 comments on commit 4310040

Please sign in to comment.