about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2018-04-07 14:04:03 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2018-04-21 22:01:38 +0200
commit654cb84852a0485146f95bbebe14ac75b7ee111a (patch)
tree0ae91c5ddd6ed83bdcdc77222a814d64fa7e03af
parentd2577ca1ec1449bd83d05e540c57447574ccaa28 (diff)
downloadrust-654cb84852a0485146f95bbebe14ac75b7ee111a.tar.gz
rust-654cb84852a0485146f95bbebe14ac75b7ee111a.zip
Add specific never search
-rw-r--r--src/librustdoc/html/static/main.js7
-rw-r--r--src/test/rustdoc-js/never.js17
2 files changed, 23 insertions, 1 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 2546a9410a9..fd8bd52cfab 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -1062,6 +1062,11 @@
                 type = matches[1].replace(/^const$/, 'constant');
                 query = query.substring(matches[0].length);
             }
+            // In case we just get a '!' as input, we can assume that the user is looking for the
+            // `Never` primitive type.
+            if (raw === '!') {
+                query = 'Never';
+            }
 
             return {
                 raw: raw,
@@ -1369,7 +1374,7 @@
 
         function search(e) {
             var params = getQueryStringParams();
-            var query = getQuery(document.getElementsByClassName('search-input')[0].value);
+            var query = getQuery(document.getElementsByClassName('search-input')[0].value.trim());
 
             if (e) {
                 e.preventDefault();
diff --git a/src/test/rustdoc-js/never.js b/src/test/rustdoc-js/never.js
new file mode 100644
index 00000000000..d9e1ca5f760
--- /dev/null
+++ b/src/test/rustdoc-js/never.js
@@ -0,0 +1,17 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+const QUERY = '!';
+
+const EXPECTED = {
+    'others': [
+        { 'path': 'std', 'name': 'never' },
+    ],
+};