Rollup merge of #96993 - notriddle:notriddle/prototype, r=GuillaumeGomez

rustdoc: fix GUI crash when searching for magic JS property values
This commit is contained in:
Matthias Krüger 2022-05-13 05:33:14 +02:00 committed by GitHub
commit 5a111dff3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 2 deletions

View File

@ -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,
@ -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;

16
src/test/rustdoc-js/prototype.js vendored Normal file
View File

@ -0,0 +1,16 @@
// exact-check
const QUERY = ['constructor', '__proto__'];
const EXPECTED = [
{
'others': [],
'returned': [],
'in_args': [],
},
{
'others': [],
'returned': [],
'in_args': [],
},
];

View File

@ -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() {}