about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2021-03-13 10:12:17 -0700
committerMichael Howell <michael@notriddle.com>2021-03-13 10:14:11 -0700
commit7834aeb95c5ddebdfadcf5cbc035912c117cc106 (patch)
tree46772437706c29918173aa97a7d449e0adc2b6d5
parentb7d14b1b4d75f6f7ea1cd1801c933f0d4f76c222 (diff)
downloadrust-7834aeb95c5ddebdfadcf5cbc035912c117cc106.tar.gz
rust-7834aeb95c5ddebdfadcf5cbc035912c117cc106.zip
Add comments regarding object shapes in buildIndex
-rw-r--r--src/librustdoc/html/static/main.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index d444bc2f257..72aa985dc59 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -1852,6 +1852,9 @@ function defocusSearchBar() {
                 var crateSize = 0;
 
                 searchWords.push(crate);
+                // This object should have exactly the same set of fields as the "row"
+                // object defined below. Your JavaScript runtime will thank you.
+                // https://mathiasbynens.be/notes/shapes-ics
                 var crateRow = {
                     crate: crate,
                     ty: 1, // == ExternCrate
@@ -1902,6 +1905,8 @@ function defocusSearchBar() {
                 len = itemTypes.length;
                 var lastPath = "";
                 for (i = 0; i < len; ++i) {
+		            // This object should have exactly the same set of fields as the "crateRow"
+		            // object defined above.
                     var row = {
                         crate: crate,
                         ty: itemTypes[i],