Skip to content

Commit ed042d0

Browse files
Correctly set up unstable items search
1 parent 2c1ac85 commit ed042d0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/librustdoc/html/static/js/search.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,13 @@ class VlqHexDecoder {
10891089
class RoaringBitmap {
10901090
/** @param {string} str */
10911091
constructor(str) {
1092+
this.keys = [];
1093+
this.cardinalities = [];
1094+
this.containers = [];
1095+
1096+
if (str === undefined || str === null) {
1097+
return;
1098+
}
10921099
// https://github.com/RoaringBitmap/RoaringFormatSpec
10931100
//
10941101
// Roaring bitmaps are used for flags that can be kept in their
@@ -1113,15 +1120,12 @@ class RoaringBitmap {
11131120
} else {
11141121
is_run = new Uint8Array();
11151122
}
1116-
this.keys = [];
1117-
this.cardinalities = [];
11181123
for (let j = 0; j < size; ++j) {
11191124
this.keys.push(u8array[i] | (u8array[i + 1] << 8));
11201125
i += 2;
11211126
this.cardinalities.push((u8array[i] | (u8array[i + 1] << 8)) + 1);
11221127
i += 2;
11231128
}
1124-
this.containers = [];
11251129
let offsets = null;
11261130
if (!has_runs || this.keys.length >= 4) {
11271131
offsets = [];
@@ -2060,9 +2064,7 @@ class DocSearch {
20602064
// Deprecated and unstable items and items with no description
20612065
this.searchIndexDeprecated.set(crate, new RoaringBitmap(crateCorpus.c));
20622066
this.searchIndexEmptyDesc.set(crate, new RoaringBitmap(crateCorpus.e));
2063-
if (crateCorpus.u !== undefined && crateCorpus.u !== null) {
2064-
this.searchIndexUnstable.set(crate, new RoaringBitmap(crateCorpus.u));
2065-
}
2067+
this.searchIndexUnstable.set(crate, new RoaringBitmap(crateCorpus.u));
20662068
let descIndex = 0;
20672069

20682070
/**

0 commit comments

Comments
 (0)