about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2025-04-11 11:35:10 -0700
committerMichael Howell <michael@notriddle.com>2025-04-11 11:36:40 -0700
commite013cf8afcf74a5f27feb7ebb0dca248e5c489fe (patch)
treeb5d12b9e1fbdfe3e3c3ec4752f7075aca40cfcce /tests
parent71b68da1bd9fa6afb9f964a731e9c843ab0862bd (diff)
rustdoc-search: add unbox flag to Result aliases
Fixes #139665
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc-js-std/unbox-type-result.js20
-rw-r--r--tests/rustdoc-js/generics-unbox.js6
-rw-r--r--tests/rustdoc-js/generics-unbox.rs12
3 files changed, 38 insertions, 0 deletions
diff --git a/tests/rustdoc-js-std/unbox-type-result.js b/tests/rustdoc-js-std/unbox-type-result.js
new file mode 100644
index 00000000000..1f5cba58adf
--- /dev/null
+++ b/tests/rustdoc-js-std/unbox-type-result.js
@@ -0,0 +1,20 @@
+// exact-check
+
+// Test case for https://github.com/rust-lang/rust/issues/139665
+// make sure that std::io::Result and std::thread::Result get unboxed
+
+const EXPECTED = [
+    {
+        query: "File -> Metadata",
+        others: [
+            { path: "std::fs::File", name: "metadata" },
+            { path: "std::fs::File", name: "metadata_at" },
+        ]
+    },
+    {
+        query: "JoinHandle<T> -> T",
+        others: [
+            { path: "std::thread::JoinHandle", name: "join" },
+        ]
+    },
+];
diff --git a/tests/rustdoc-js/generics-unbox.js b/tests/rustdoc-js/generics-unbox.js
index 6baf00c814b..a4f2ba8e3a6 100644
--- a/tests/rustdoc-js/generics-unbox.js
+++ b/tests/rustdoc-js/generics-unbox.js
@@ -31,4 +31,10 @@ const EXPECTED = [
             { 'path': 'generics_unbox', 'name': 'beta' },
         ],
     },
+    {
+        'query': '-> Sigma',
+        'others': [
+            { 'path': 'generics_unbox', 'name': 'delta' },
+        ],
+    },
 ];
diff --git a/tests/rustdoc-js/generics-unbox.rs b/tests/rustdoc-js/generics-unbox.rs
index c2578575997..b16e35ee3d4 100644
--- a/tests/rustdoc-js/generics-unbox.rs
+++ b/tests/rustdoc-js/generics-unbox.rs
@@ -42,3 +42,15 @@ pub fn beta<T, U>(_: Inside<T>) -> Out<Out3<T, U>, Out4<U, T>> {
 pub fn gamma<T, U>(_: Inside<T>) -> Out<Out3<U, T>, Out4<T, U>> {
     loop {}
 }
+
+pub fn delta(_: i32) -> Epsilon<Sigma> {
+    loop {}
+}
+
+#[doc(search_unbox)]
+pub struct Theta<T>(T);
+
+#[doc(search_unbox)]
+pub type Epsilon<T> = Theta<T>;
+
+pub struct Sigma;