about summary refs log tree commit diff
path: root/src/librustdoc/html/static/js/externs.js
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2023-04-15 11:53:50 -0700
committerMichael Howell <michael@notriddle.com>2023-04-17 12:16:54 -0700
commit4c11822aebd9e9c3bbe798f14fa10ec6db3f3937 (patch)
treece89e933ebd8fb99605784ddf0c97e8f3a22e20d /src/librustdoc/html/static/js/externs.js
parent1a7132d4f8dfb2ed6f9267b3bac5391a992d0775 (diff)
downloadrust-4c11822aebd9e9c3bbe798f14fa10ec6db3f3937.tar.gz
rust-4c11822aebd9e9c3bbe798f14fa10ec6db3f3937.zip
rustdoc: restructure type search engine to pick-and-use IDs
This change makes it so, instead of mixing string distance with
type unification, function signature search works by
mapping names to IDs at the start, reporting to the user any
cases where it had to make corrections, and then matches with
IDs when going through the items.

This only changes function searches. Name searches are left alone,
and corrections are only done when there's a single item in the
search query.
Diffstat (limited to 'src/librustdoc/html/static/js/externs.js')
-rw-r--r--src/librustdoc/html/static/js/externs.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/librustdoc/html/static/js/externs.js b/src/librustdoc/html/static/js/externs.js
index 4c81a0979c1..8b931f74e60 100644
--- a/src/librustdoc/html/static/js/externs.js
+++ b/src/librustdoc/html/static/js/externs.js
@@ -9,6 +9,7 @@ function initSearch(searchIndex){}
 /**
  * @typedef {{
  *     name: string,
+ *     id: integer,
  *     fullPath: Array<string>,
  *     pathWithoutLast: Array<string>,
  *     pathLast: string,
@@ -36,6 +37,8 @@ let ParserState;
  *     args: Array<QueryElement>,
  *     returned: Array<QueryElement>,
  *     foundElems: number,
+ *     literalSearch: boolean,
+ *     corrections: Array<{from: string, to: integer}>,
  * }}
  */
 let ParsedQuery;
@@ -139,7 +142,7 @@ let FunctionSearchType;
 
 /**
  * @typedef {{
- *     name: (null|string),
+ *     id: (null|number),
  *     ty: (null|number),
  *     generics: Array<FunctionType>,
  * }}