diff options
| author | bors <bors@rust-lang.org> | 2022-04-27 01:01:58 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-04-27 01:01:58 +0000 |
| commit | 99b70ee230a363220d97148d567f07366d7ea4e0 (patch) | |
| tree | 5c9df8d245757383f2ee1c52162320d91dc98d09 /src/librustdoc/html/static/js | |
| parent | a7197189cd0e3a86d1b661d1dceb8bdff021d0b8 (diff) | |
| parent | c0ed53c0dab14b9000abe4e6c9e86918d8c48224 (diff) | |
| download | rust-99b70ee230a363220d97148d567f07366d7ea4e0.tar.gz rust-99b70ee230a363220d97148d567f07366d7ea4e0.zip | |
Auto merge of #96459 - Dylan-DPC:rollup-de6ud9d, r=Dylan-DPC
Rollup of 6 pull requests
Successful merges:
- #92569 (Improve Error Messaging for Unconstructed Structs and Enum Variants in Generic Contexts)
- #96370 (Cleanup `report_method_error` a bit)
- #96383 (Fix erased region escaping into wfcheck due to #95395)
- #96385 (Recover most `impl Trait` and `dyn Trait` lifetime bound suggestions under NLL)
- #96410 (rustdoc: do not write `{{root}}` in `pub use ::foo` docs)
- #96430 (Fix handling of `!` in rustdoc search)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/librustdoc/html/static/js')
| -rw-r--r-- | src/librustdoc/html/static/js/search.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index c4e74ea0657..c1d2ec540b0 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -310,10 +310,20 @@ window.initSearch = function(rawSearchIndex) { */ function getIdentEndPosition(parserState) { let end = parserState.pos; + let foundExclamation = false; while (parserState.pos < parserState.length) { const c = parserState.userQuery[parserState.pos]; if (!isIdentCharacter(c)) { - if (isErrorCharacter(c)) { + if (c === "!") { + if (foundExclamation) { + throw new Error("Cannot have more than one `!` in an ident"); + } else if (parserState.pos + 1 < parserState.length && + isIdentCharacter(parserState.userQuery[parserState.pos + 1])) + { + throw new Error("`!` can only be at the end of an ident"); + } + foundExclamation = true; + } else if (isErrorCharacter(c)) { throw new Error(`Unexpected \`${c}\``); } else if ( isStopCharacter(c) || @@ -329,6 +339,7 @@ window.initSearch = function(rawSearchIndex) { } // Skip current ":". parserState.pos += 1; + foundExclamation = false; } else { throw new Error(`Unexpected \`${c}\``); } @@ -591,7 +602,7 @@ window.initSearch = function(rawSearchIndex) { * * The supported syntax by this parser is as follow: * - * ident = *(ALPHA / DIGIT / "_") + * ident = *(ALPHA / DIGIT / "_") [!] * path = ident *(DOUBLE-COLON ident) * arg = path [generics] * arg-without-generic = path |
