rustdoc: fix GUI crash when searching for magic JS property values
This commit is contained in:
parent
c6499fd998
commit
d3fd6bfd30
3 changed files with 22 additions and 2 deletions
|
@ -119,7 +119,7 @@ window.initSearch = rawSearchIndex => {
|
||||||
*/
|
*/
|
||||||
let searchIndex;
|
let searchIndex;
|
||||||
let currentResults;
|
let currentResults;
|
||||||
const ALIASES = {};
|
const ALIASES = Object.create(null);
|
||||||
const params = searchState.getQueryStringParams();
|
const params = searchState.getQueryStringParams();
|
||||||
|
|
||||||
// Populate search bar with query string search term when provided,
|
// Populate search bar with query string search term when provided,
|
||||||
|
@ -1953,7 +1953,7 @@ window.initSearch = rawSearchIndex => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aliases) {
|
if (aliases) {
|
||||||
ALIASES[crate] = {};
|
ALIASES[crate] = Object.create(null);
|
||||||
for (const alias_name in aliases) {
|
for (const alias_name in aliases) {
|
||||||
if (!hasOwnPropertyRustdoc(aliases, alias_name)) {
|
if (!hasOwnPropertyRustdoc(aliases, alias_name)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
16
src/test/rustdoc-js/prototype.js
vendored
Normal file
16
src/test/rustdoc-js/prototype.js
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
// exact-check
|
||||||
|
|
||||||
|
const QUERY = ['constructor', '__proto__'];
|
||||||
|
|
||||||
|
const EXPECTED = [
|
||||||
|
{
|
||||||
|
'others': [],
|
||||||
|
'returned': [],
|
||||||
|
'in_args': [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'others': [],
|
||||||
|
'returned': [],
|
||||||
|
'in_args': [],
|
||||||
|
},
|
||||||
|
];
|
4
src/test/rustdoc-js/prototype.rs
Normal file
4
src/test/rustdoc-js/prototype.rs
Normal 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() {}
|
Loading…
Add table
Add a link
Reference in a new issue