about summary refs log tree commit diff
path: root/tests/rustdoc-js-std
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-04-18 21:23:15 +0000
committerbors <bors@rust-lang.org>2024-04-18 21:23:15 +0000
commite3181b091e88321f5ea149afed6db0edf0a4f37b (patch)
tree6ff2feb52920f80ff744c832385c5da2b126581a /tests/rustdoc-js-std
parent3412f0174934778dd803081dc7c4b5864309350f (diff)
parent226c77d0a4397d19542fd9e752fa75247befe9e0 (diff)
downloadrust-e3181b091e88321f5ea149afed6db0edf0a4f37b.tar.gz
rust-e3181b091e88321f5ea149afed6db0edf0a4f37b.zip
Auto merge of #119912 - notriddle:notriddle/reexport-dedup, r=GuillaumeGomez
rustdoc-search: single result for items with multiple paths

Part of #15723

Preview: https://notriddle.com/rustdoc-html-demo-9/reexport-dup/std/index.html?search=hashmap

This change uses the same "exact" paths as trait implementors and type alias inlining to track items with multiple reachable paths. This way, if you search for `vec`, you get only the `std` exports of it, and not the one from `alloc`.

It still includes all the items in the search index so that you can search for them by all available paths. For example, try `core::option` and `std::option`, and notice that the results page doesn't show duplicates, but still shows all the items in their respective crates.
Diffstat (limited to 'tests/rustdoc-js-std')
-rw-r--r--tests/rustdoc-js-std/vec-new.js36
1 files changed, 33 insertions, 3 deletions
diff --git a/tests/rustdoc-js-std/vec-new.js b/tests/rustdoc-js-std/vec-new.js
index 9823a417a5d..bb122ff4398 100644
--- a/tests/rustdoc-js-std/vec-new.js
+++ b/tests/rustdoc-js-std/vec-new.js
@@ -3,17 +3,47 @@ const EXPECTED = [
         'query': 'Vec::new',
         'others': [
             { 'path': 'std::vec::Vec', 'name': 'new' },
-            { 'path': 'alloc::vec::Vec', 'name': 'new' },
             { 'path': 'std::vec::Vec', 'name': 'new_in' },
-            { 'path': 'alloc::vec::Vec', 'name': 'new_in' },
+        ],
+    },
+    {
+        'query': 'prelude::vec',
+        'others': [
+            { 'path': 'std::prelude::rust_2024', 'name': 'Vec' },
         ],
     },
     {
         'query': 'Vec new',
         'others': [
             { 'path': 'std::vec::Vec', 'name': 'new' },
-            { 'path': 'alloc::vec::Vec', 'name': 'new' },
             { 'path': 'std::vec::Vec', 'name': 'new_in' },
+        ],
+    },
+    {
+        'query': 'std::Vec::new',
+        'others': [
+            { 'path': 'std::vec::Vec', 'name': 'new' },
+            { 'path': 'std::vec::Vec', 'name': 'new_in' },
+        ],
+    },
+    {
+        'query': 'std Vec new',
+        'others': [
+            { 'path': 'std::vec::Vec', 'name': 'new' },
+            { 'path': 'std::vec::Vec', 'name': 'new_in' },
+        ],
+    },
+    {
+        'query': 'alloc::Vec::new',
+        'others': [
+            { 'path': 'alloc::vec::Vec', 'name': 'new' },
+            { 'path': 'alloc::vec::Vec', 'name': 'new_in' },
+        ],
+    },
+    {
+        'query': 'alloc Vec new',
+        'others': [
+            { 'path': 'alloc::vec::Vec', 'name': 'new' },
             { 'path': 'alloc::vec::Vec', 'name': 'new_in' },
         ],
     },