diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-05-13 05:33:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-13 05:33:14 +0200 |
| commit | 5a111dff3b613209d2ffd8acbf20f2c910655dc9 (patch) | |
| tree | ed19562ab0ee4e6a2883e2e5c5d8c0772d922a38 | |
| parent | f2100daf3251373ab57c68e0576ee60bffa55e6d (diff) | |
| parent | d3fd6bfd308f1cca010086e30e75daaee984beab (diff) | |
| download | rust-5a111dff3b613209d2ffd8acbf20f2c910655dc9.tar.gz rust-5a111dff3b613209d2ffd8acbf20f2c910655dc9.zip | |
Rollup merge of #96993 - notriddle:notriddle/prototype, r=GuillaumeGomez
rustdoc: fix GUI crash when searching for magic JS property values
| -rw-r--r-- | src/librustdoc/html/static/js/search.js | 4 | ||||
| -rw-r--r-- | src/test/rustdoc-js/prototype.js | 16 | ||||
| -rw-r--r-- | src/test/rustdoc-js/prototype.rs | 4 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 7754d626e20..b596adf32c6 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -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; diff --git a/src/test/rustdoc-js/prototype.js b/src/test/rustdoc-js/prototype.js new file mode 100644 index 00000000000..2f1d841c3be --- /dev/null +++ b/src/test/rustdoc-js/prototype.js @@ -0,0 +1,16 @@ +// exact-check + +const QUERY = ['constructor', '__proto__']; + +const EXPECTED = [ + { + 'others': [], + 'returned': [], + 'in_args': [], + }, + { + 'others': [], + 'returned': [], + 'in_args': [], + }, +]; diff --git a/src/test/rustdoc-js/prototype.rs b/src/test/rustdoc-js/prototype.rs new file mode 100644 index 00000000000..5f6d73cc196 --- /dev/null +++ b/src/test/rustdoc-js/prototype.rs @@ -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() {} |
