diff options
| author | Michael Howell <michael@notriddle.com> | 2023-08-05 12:27:58 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2023-09-03 13:06:08 -0700 |
| commit | 60688500089f8e182e35f7ae540e9941734053a4 (patch) | |
| tree | 0c6a54267294b79bb84692945f41cfeafa51a7bb | |
| parent | 89a4c7f552558c293b29437b4b79223786f1923d (diff) | |
| download | rust-60688500089f8e182e35f7ae540e9941734053a4.tar.gz rust-60688500089f8e182e35f7ae540e9941734053a4.zip | |
rustdoc: fix test case for generics that look like names
| -rw-r--r-- | src/librustdoc/html/static/js/search.js | 3 | ||||
| -rw-r--r-- | src/tools/rustdoc-js/tester.js | 4 | ||||
| -rw-r--r-- | tests/rustdoc-js/generics-trait.js | 8 |
3 files changed, 11 insertions, 4 deletions
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index fb478cbff3c..b867311aca1 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -1983,7 +1983,8 @@ function initSearch(rawSearchIndex) { } elem.id = match; } - if ((elem.id === null && parsedQuery.totalElems > 1 && elem.typeFilter === -1) + if ((elem.id === null && parsedQuery.totalElems > 1 && elem.typeFilter === -1 + && elem.generics.length === 0) || elem.typeFilter === TY_GENERIC) { if (genericSymbols.has(elem.name)) { elem.id = genericSymbols.get(elem.name); diff --git a/src/tools/rustdoc-js/tester.js b/src/tools/rustdoc-js/tester.js index 416517d15f5..c7e6dd3615e 100644 --- a/src/tools/rustdoc-js/tester.js +++ b/src/tools/rustdoc-js/tester.js @@ -23,7 +23,9 @@ function contentToDiffLine(key, value) { } function shouldIgnoreField(fieldName) { - return fieldName === "query" || fieldName === "correction"; + return fieldName === "query" || fieldName === "correction" || + fieldName === "proposeCorrectionFrom" || + fieldName === "proposeCorrectionTo"; } // This function is only called when no matching result was found and therefore will only display diff --git a/tests/rustdoc-js/generics-trait.js b/tests/rustdoc-js/generics-trait.js index 4ccfb8f4e4d..a71393b5e05 100644 --- a/tests/rustdoc-js/generics-trait.js +++ b/tests/rustdoc-js/generics-trait.js @@ -12,12 +12,16 @@ const EXPECTED = [ ], }, { - 'query': 'Result<SomeTraiz>', - 'correction': null, + 'query': 'Resulx<SomeTrait>', 'in_args': [], 'returned': [], }, { + 'query': 'Result<SomeTraiz>', + 'proposeCorrectionFrom': 'SomeTraiz', + 'proposeCorrectionTo': 'SomeTrait', + }, + { 'query': 'OtherThingxxxxxxxx', 'correction': null, 'in_args': [ |
