Skip to content

Commit 5a111df

Browse files
authored
Rollup merge of #96993 - notriddle:notriddle/prototype, r=GuillaumeGomez
rustdoc: fix GUI crash when searching for magic JS property values
2 parents f2100da + d3fd6bf commit 5a111df

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ window.initSearch = rawSearchIndex => {
119119
*/
120120
let searchIndex;
121121
let currentResults;
122-
const ALIASES = {};
122+
const ALIASES = Object.create(null);
123123
const params = searchState.getQueryStringParams();
124124

125125
// Populate search bar with query string search term when provided,
@@ -1953,7 +1953,7 @@ window.initSearch = rawSearchIndex => {
19531953
}
19541954

19551955
if (aliases) {
1956-
ALIASES[crate] = {};
1956+
ALIASES[crate] = Object.create(null);
19571957
for (const alias_name in aliases) {
19581958
if (!hasOwnPropertyRustdoc(aliases, alias_name)) {
19591959
continue;

src/test/rustdoc-js/prototype.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// exact-check
2+
3+
const QUERY = ['constructor', '__proto__'];
4+
5+
const EXPECTED = [
6+
{
7+
'others': [],
8+
'returned': [],
9+
'in_args': [],
10+
},
11+
{
12+
'others': [],
13+
'returned': [],
14+
'in_args': [],
15+
},
16+
];

src/test/rustdoc-js/prototype.rs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// The alias needed to be there to reproduce the bug
2+
// that used to be here.
3+
#[doc(alias="other_alias")]
4+
pub fn something_else() {}

0 commit comments

Comments
 (0)