about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNoah Lev <camelidcamel@gmail.com>2024-07-31 20:13:17 -0700
committerNoah Lev <camelidcamel@gmail.com>2024-08-04 12:49:28 -0700
commitdac7f20e1308ea17655d17f43dffaca813857300 (patch)
tree14ea3d8710bd823bed457630ce6d78b30fe01696
parentb4f77df9f8540f48744794c641e12ef66e0e57ba (diff)
downloadrust-dac7f20e1308ea17655d17f43dffaca813857300.tar.gz
rust-dac7f20e1308ea17655d17f43dffaca813857300.zip
Add test for `Self` not being a generic in search index
-rw-r--r--tests/rustdoc-js/self-is-not-generic.js22
-rw-r--r--tests/rustdoc-js/self-is-not-generic.rs11
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/rustdoc-js/self-is-not-generic.js b/tests/rustdoc-js/self-is-not-generic.js
new file mode 100644
index 00000000000..0fdf5b4117d
--- /dev/null
+++ b/tests/rustdoc-js/self-is-not-generic.js
@@ -0,0 +1,22 @@
+// exact-check
+
+const EXPECTED = [
+    {
+        'query': 'A -> A',
+        'others': [
+            { 'path': 'self_is_not_generic::Thing', 'name': 'from' }
+        ],
+    },
+    {
+        'query': 'A -> B',
+        'others': [
+            { 'path': 'self_is_not_generic::Thing', 'name': 'try_from' }
+        ],
+    },
+    {
+        'query': 'Combine -> Combine',
+        'others': [
+            { 'path': 'self_is_not_generic::Combine', 'name': 'combine' }
+        ],
+    }
+];
diff --git a/tests/rustdoc-js/self-is-not-generic.rs b/tests/rustdoc-js/self-is-not-generic.rs
new file mode 100644
index 00000000000..d6a96acb73c
--- /dev/null
+++ b/tests/rustdoc-js/self-is-not-generic.rs
@@ -0,0 +1,11 @@
+pub trait Combine {
+    fn combine(&self, other: &Self) -> Self;
+}
+
+pub struct Thing;
+
+impl Combine for Thing {
+    fn combine(&self, other: &Self) -> Self {
+        Self
+    }
+}