Skip to content

Commit

Permalink
Rollup merge of #96993 - notriddle:notriddle/prototype, r=GuillaumeGomez
Browse files Browse the repository at this point in the history
rustdoc: fix GUI crash when searching for magic JS property values
  • Loading branch information
GuillaumeGomez authored May 12, 2022
2 parents 8310eb8 + d3fd6bf commit c5ea430
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ window.initSearch = rawSearchIndex => {
*/
let searchIndex;
let currentResults;
const ALIASES = {};
const ALIASES = Object.create(null);
const params = searchState.getQueryStringParams();

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

if (aliases) {
ALIASES[crate] = {};
ALIASES[crate] = Object.create(null);
for (const alias_name in aliases) {
if (!hasOwnPropertyRustdoc(aliases, alias_name)) {
continue;
Expand Down
16 changes: 16 additions & 0 deletions src/test/rustdoc-js/prototype.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// exact-check

const QUERY = ['constructor', '__proto__'];

const EXPECTED = [
{
'others': [],
'returned': [],
'in_args': [],
},
{
'others': [],
'returned': [],
'in_args': [],
},
];
4 changes: 4 additions & 0 deletions src/test/rustdoc-js/prototype.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// The alias needed to be there to reproduce the bug
// that used to be here.
#[doc(alias="other_alias")]
pub fn something_else() {}

0 comments on commit c5ea430

Please sign in to comment.