about summary refs log tree commit diff
path: root/tests/rustdoc-js-std/parser-ident.js
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2023-06-12 14:56:54 -0700
committerMichael Howell <michael@notriddle.com>2023-06-12 17:30:23 -0700
commitdb277f528407864e24d3d7934d9c23e28d950165 (patch)
tree27f6edb2a3b0e81f6e3265af83b2cd19ba4993fe /tests/rustdoc-js-std/parser-ident.js
parentdf77afbcaf3365a32066a8ca4a00ae6fc9a69647 (diff)
downloadrust-db277f528407864e24d3d7934d9c23e28d950165.tar.gz
rust-db277f528407864e24d3d7934d9c23e28d950165.zip
rustdoc-search: search never type with `!`
This feature extends rustdoc to support the syntax that most users will
naturally attempt to use to search for diverging functions.
Part of #60485

It's already possible to do this search with `primitive:never`, but
that's not what the Rust language itself uses, so nobody will try it if
they aren't told or helped along.
Diffstat (limited to 'tests/rustdoc-js-std/parser-ident.js')
-rw-r--r--tests/rustdoc-js-std/parser-ident.js80
1 files changed, 71 insertions, 9 deletions
diff --git a/tests/rustdoc-js-std/parser-ident.js b/tests/rustdoc-js-std/parser-ident.js
index d9ee5fb564b..f65a7ce6692 100644
--- a/tests/rustdoc-js-std/parser-ident.js
+++ b/tests/rustdoc-js-std/parser-ident.js
@@ -8,11 +8,12 @@ const PARSED = [
             pathLast: "r",
             generics: [
                 {
-                    name: "!",
-                    fullPath: ["!"],
+                    name: "never",
+                    fullPath: ["never"],
                     pathWithoutLast: [],
-                    pathLast: "!",
+                    pathLast: "never",
                     generics: [],
+                    typeFilter: 15,
                 },
             ],
             typeFilter: -1,
@@ -26,12 +27,12 @@ const PARSED = [
     {
         query: "!",
         elems: [{
-            name: "!",
-            fullPath: ["!"],
+            name: "never",
+            fullPath: ["never"],
             pathWithoutLast: [],
-            pathLast: "!",
+            pathLast: "never",
             generics: [],
-            typeFilter: -1,
+            typeFilter: 15,
         }],
         foundElems: 1,
         original: "!",
@@ -65,11 +66,20 @@ const PARSED = [
         error: "Cannot have associated items in macros",
     },
     {
+        query: "!<T>",
+        elems: [],
+        foundElems: 0,
+        original: "!<T>",
+        returned: [],
+        userQuery: "!<t>",
+        error: "Never type `!` does not accept generic parameters",
+    },
+    {
         query: "!::b",
         elems: [{
             name: "!::b",
-            fullPath: ["!", "b"],
-            pathWithoutLast: ["!"],
+            fullPath: ["never", "b"],
+            pathWithoutLast: ["never"],
             pathLast: "b",
             generics: [],
             typeFilter: -1,
@@ -81,6 +91,58 @@ const PARSED = [
         error: null,
     },
     {
+        query: "b::!",
+        elems: [],
+        foundElems: 0,
+        original: "b::!",
+        returned: [],
+        userQuery: "b::!",
+        error: "Never type `!` is not associated item",
+    },
+    {
+        query: "!::!",
+        elems: [],
+        foundElems: 0,
+        original: "!::!",
+        returned: [],
+        userQuery: "!::!",
+        error: "Never type `!` is not associated item",
+    },
+    {
+        query: "b::!::c",
+        elems: [],
+        foundElems: 0,
+        original: "b::!::c",
+        returned: [],
+        userQuery: "b::!::c",
+        error: "Never type `!` is not associated item",
+    },
+    {
+        query: "!::b<T>",
+        elems: [{
+            name: "!::b",
+            fullPath: ["never", "b"],
+            pathWithoutLast: ["never"],
+            pathLast: "b",
+            generics: [
+                {
+                    name: "t",
+                    fullPath: ["t"],
+                    pathWithoutLast: [],
+                    pathLast: "t",
+                    generics: [],
+                    typeFilter: -1,
+                }
+            ],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        original: "!::b<T>",
+        returned: [],
+        userQuery: "!::b<t>",
+        error: null,
+    },
+    {
         query: "a!::b!",
         elems: [],
         foundElems: 0,