Skip to content
1 change: 0 additions & 1 deletion src/librustdoc/formats/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,6 @@ fn add_item_to_search_index(tcx: TyCtxt<'_>, cache: &mut Cache, item: &clean::It
search_type,
aliases,
deprecation,
is_unstable: item.stability(tcx).map(|x| x.is_unstable()).unwrap_or(false),
};
cache.search_index.push(index_item);
}
Expand Down
1 change: 0 additions & 1 deletion src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ pub(crate) struct IndexItem {
pub(crate) search_type: Option<IndexItemFunctionType>,
pub(crate) aliases: Box<[Symbol]>,
pub(crate) deprecation: Option<Deprecation>,
pub(crate) is_unstable: bool,
}

/// A type used for the search index.
Expand Down
6 changes: 0 additions & 6 deletions src/librustdoc/html/render/search_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ pub(crate) fn build_index(
),
aliases: item.attrs.get_doc_aliases(),
deprecation: item.deprecation(tcx),
is_unstable: item.stability(tcx).is_some_and(|x| x.is_unstable()),
});
}
}
Expand Down Expand Up @@ -656,7 +655,6 @@ pub(crate) fn build_index(
let mut parents_backref_queue = VecDeque::new();
let mut functions = String::with_capacity(self.items.len());
let mut deprecated = Vec::with_capacity(self.items.len());
let mut unstable = Vec::with_capacity(self.items.len());

let mut type_backref_queue = VecDeque::new();

Expand Down Expand Up @@ -713,9 +711,6 @@ pub(crate) fn build_index(
// bitmasks always use 1-indexing for items, with 0 as the crate itself
deprecated.push(u32::try_from(index + 1).unwrap());
}
if item.is_unstable {
unstable.push(u32::try_from(index + 1).unwrap());
}
}

for (index, path) in &revert_extra_paths {
Expand Down Expand Up @@ -754,7 +749,6 @@ pub(crate) fn build_index(
crate_data.serialize_field("r", &re_exports)?;
crate_data.serialize_field("b", &self.associated_item_disambiguators)?;
crate_data.serialize_field("c", &bitmap_to_string(&deprecated))?;
crate_data.serialize_field("u", &bitmap_to_string(&unstable))?;
crate_data.serialize_field("e", &bitmap_to_string(&self.empty_desc))?;
crate_data.serialize_field("P", &param_names)?;
if has_aliases {
Expand Down
5 changes: 1 addition & 4 deletions src/librustdoc/html/static/js/rustdoc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ declare namespace rustdoc {

/**
* A single parsed "atom" in a search query. For example,
*
*
* std::fmt::Formatter, Write -> Result<()>
* ┏━━━━━━━━━━━━━━━━━━ ┌──── ┏━━━━━┅┅┅┅┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐
* ┃ │ ┗ QueryElement { ┊
Expand Down Expand Up @@ -449,8 +449,6 @@ declare namespace rustdoc {
* of `p`) but is used for modules items like free functions.
*
* `c` is an array of item indices that are deprecated.
*
* `u` is an array of item indices that are unstable.
*/
type RawSearchIndexCrate = {
doc: string,
Expand All @@ -465,7 +463,6 @@ declare namespace rustdoc {
p: Array<[number, string] | [number, string, number] | [number, string, number, number] | [number, string, number, number, string]>,
b: Array<[number, String]>,
c: string,
u: string,
r: Array<[number, number]>,
P: Array<[number, string]>,
};
Expand Down
29 changes: 1 addition & 28 deletions src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -1464,11 +1464,6 @@ class DocSearch {
* @type {Map<String, RoaringBitmap>}
*/
this.searchIndexEmptyDesc = new Map();
/**
* @type {Map<String, RoaringBitmap>}
*/
this.searchIndexUnstable = new Map();

/**
* @type {Uint32Array}
*/
Expand Down Expand Up @@ -2057,12 +2052,9 @@ class DocSearch {
};
const descShardList = [descShard];

// Deprecated and unstable items and items with no description
// Deprecated items and items with no description
this.searchIndexDeprecated.set(crate, new RoaringBitmap(crateCorpus.c));
this.searchIndexEmptyDesc.set(crate, new RoaringBitmap(crateCorpus.e));
if (crateCorpus.u !== undefined && crateCorpus.u !== null) {
this.searchIndexUnstable.set(crate, new RoaringBitmap(crateCorpus.u));
}
let descIndex = 0;

/**
Expand Down Expand Up @@ -3334,25 +3326,6 @@ class DocSearch {
return a - b;
}

// sort unstable items later
// FIXME: there is some doubt if this is the most effecient way to implement this.
// alternative options include:
// * put is_unstable on each item when the index is built.
// increases memory usage but avoids a hashmap lookup.
// * put is_unstable on each item before sorting.
// better worst case performance but worse average case performance.
a = Number(
// @ts-expect-error
this.searchIndexUnstable.get(aaa.item.crate).contains(aaa.item.bitIndex),
);
b = Number(
// @ts-expect-error
this.searchIndexUnstable.get(bbb.item.crate).contains(bbb.item.bitIndex),
);
if (a !== b) {
return a - b;
}

// sort by crate (current crate comes first)
a = Number(aaa.item.crate !== preferredCrate);
b = Number(bbb.item.crate !== preferredCrate);
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-js-std/core-transmute.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ const EXPECTED = [
{
'query': 'generic:T -> generic:U',
'others': [
{ 'path': 'core::mem', 'name': 'transmute' },
{ 'path': 'core::intrinsics::simd', 'name': 'simd_as' },
{ 'path': 'core::intrinsics::simd', 'name': 'simd_cast' },
{ 'path': 'core::mem', 'name': 'transmute' },
],
},
];
2 changes: 1 addition & 1 deletion tests/rustdoc-js-std/transmute-fail.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const EXPECTED = [
// should-fail tag and the search query below:
'query': 'generic:T -> generic:T',
'others': [
{ 'path': 'std::mem', 'name': 'transmute' },
{ 'path': 'std::intrinsics::simd', 'name': 'simd_as' },
{ 'path': 'std::intrinsics::simd', 'name': 'simd_cast' },
{ 'path': 'std::mem', 'name': 'transmute' },
],
},
];
2 changes: 1 addition & 1 deletion tests/rustdoc-js-std/transmute.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const EXPECTED = [
// should-fail tag and the search query below:
'query': 'generic:T -> generic:U',
'others': [
{ 'path': 'std::mem', 'name': 'transmute' },
{ 'path': 'std::intrinsics::simd', 'name': 'simd_as' },
{ 'path': 'std::intrinsics::simd', 'name': 'simd_cast' },
{ 'path': 'std::mem', 'name': 'transmute' },
],
},
];
9 changes: 0 additions & 9 deletions tests/rustdoc-js/sort-stability.js

This file was deleted.

16 changes: 0 additions & 16 deletions tests/rustdoc-js/sort-stability.rs

This file was deleted.

Loading