Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc: fix GUI crash when searching for magic JS property values #96993

Merged
merged 1 commit into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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() {}