diff options
| author | bors <bors@rust-lang.org> | 2025-10-03 08:43:43 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-10-03 08:43:43 +0000 |
| commit | dd091003ace19d9556c647d87f7a9cd1e8dcc17e (patch) | |
| tree | e664b8e4a5837e0f2245f51c41765da6fce596cf /tests/rustdoc-js | |
| parent | 3b8665c5ab3aeced9b01672404c3764583e722ca (diff) | |
| parent | c7d6857f750a8c957ebca81340faa379cc3d110f (diff) | |
| download | rust-dd091003ace19d9556c647d87f7a9cd1e8dcc17e.tar.gz rust-dd091003ace19d9556c647d87f7a9cd1e8dcc17e.zip | |
Auto merge of #145898 - lolbinarycat:rustdoc-search-trait-parent, r=GuillaumeGomez,notriddle
If a trait item appears in rustdoc search, hide the corrosponding impl items fixes rust-lang/rust#138251 cc `@notriddle`
Diffstat (limited to 'tests/rustdoc-js')
| -rw-r--r-- | tests/rustdoc-js/trait-methods.js | 20 | ||||
| -rw-r--r-- | tests/rustdoc-js/trait-methods.rs | 18 |
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/rustdoc-js/trait-methods.js b/tests/rustdoc-js/trait-methods.js index dafad5e4378..083e52439f4 100644 --- a/tests/rustdoc-js/trait-methods.js +++ b/tests/rustdoc-js/trait-methods.js @@ -9,4 +9,24 @@ const EXPECTED = [ { 'path': 'trait_methods::MyTrait', 'name': 'next' }, ], }, + // the traitParent deduplication pass should remove + // Empty::next, as it would be redundant + { + 'query': 'next', + 'correction': null, + 'in_args': [], + 'others': [ + { 'path': 'trait_methods::MyTrait', 'name': 'next' }, + ], + }, + // if the trait does not match, no deduplication happens + { + 'query': '-> option<()>', + 'correction': null, + 'in_args': [], + 'others': [ + { 'path': 'trait_methods::Empty', 'name': 'next' }, + { 'path': 'trait_methods::Void', 'name': 'next' }, + ], + }, ]; diff --git a/tests/rustdoc-js/trait-methods.rs b/tests/rustdoc-js/trait-methods.rs index c88f5edfd55..a741b361a33 100644 --- a/tests/rustdoc-js/trait-methods.rs +++ b/tests/rustdoc-js/trait-methods.rs @@ -2,3 +2,21 @@ pub trait MyTrait { type Item; fn next(&mut self) -> Option<Self::Item>; } + +pub struct Empty; + +impl MyTrait for Empty { + type Item = (); + fn next(&mut self) -> Option<()> { + None + } +} + +pub struct Void; + +impl MyTrait for Void { + type Item = (); + fn next(&mut self) -> Option<()> { + Some(()) + } +} |
