about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2023-04-19 10:16:14 -0700
committerMichael Howell <michael@notriddle.com>2023-04-19 12:56:52 -0700
commitb6f81e04347d9dbd29e59e7dbca3f9289ddb2fe3 (patch)
treeefd9ffd2cc20b89691e52cc305ff84536890ba22 /src
parent4c11822aebd9e9c3bbe798f14fa10ec6db3f3937 (diff)
downloadrust-b6f81e04347d9dbd29e59e7dbca3f9289ddb2fe3.tar.gz
rust-b6f81e04347d9dbd29e59e7dbca3f9289ddb2fe3.zip
rustdoc-search: give longer notification for type corrections
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/static/js/search.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js
index 2d0a3f0192b..1bee6987739 100644
--- a/src/librustdoc/html/static/js/search.js
+++ b/src/librustdoc/html/static/js/search.js
@@ -1996,8 +1996,13 @@ function initSearch(rawSearchIndex) {
         }
 
         if (results.query.correction !== null) {
-            output += "<h3 class=\"search-corrections\">Showing results for " +
-                `"${results.query.correction}".</h3>`;
+            const orig = results.query.returned.length > 0
+                ? results.query.returned[0].name
+                : results.query.elems[0].name;
+            output += "<h3 class=\"search-corrections\">" +
+                `Type "${orig}" not found. ` +
+                "Showing results for " +
+                `"${results.query.correction}" instead.</h3>`;
         }
 
         const resultsElem = document.createElement("div");