diff options
| author | Michael Howell <michael@notriddle.com> | 2023-03-20 16:02:51 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2023-09-21 15:16:44 -0700 |
| commit | 3fbfe2bca5e0227e2b9c9363558dc6a5dec54351 (patch) | |
| tree | 38c55ee46169ae84ca18c01c3dad56228bd8c208 /tests/rustdoc | |
| parent | 9683f8a9656580aae49f7664a5134d061b795b3f (diff) | |
| download | rust-3fbfe2bca5e0227e2b9c9363558dc6a5dec54351.tar.gz rust-3fbfe2bca5e0227e2b9c9363558dc6a5dec54351.zip | |
rustdoc-search: add impl disambiguator to duplicate assoc items
Helps with #90929 This changes the search results, specifically, when there's more than one impl with an associated item with the same name. For example, the search queries `simd<i8> -> simd<i8>` and `simd<i64> -> simd<i64>` don't link to the same function, but most of the functions have the same names. This change should probably be FCP-ed, especially since it adds a new anchor link format for `main.js` to handle, so that URLs like `struct.Vec.html#impl-AsMut<[T]>-for-Vec<T,+A>/method.as_mut` redirect to `struct.Vec.html#method.as_mut-2`. It's a strange design, but there are a few reasons for it: * I'd like to avoid making the HTML bigger. Obviously, fixing this bug is going to add at least a little more data to the search index, but adding more HTML penalises viewers for the benefit of searchers. * Breaking `struct.Vec.html#method.len` would also be a disappointment. On the other hand: * The path-style anchors might be less prone to link rot than the numbered anchors. It's definitely less likely to have URLs that appear to "work", but silently point at the wrong thing. * This commit arranges the path-style anchor to redirect to the numbered anchor. Nothing stops rustdoc from doing the opposite, making path-style anchors the default and redirecting the "legacy" numbered ones.
Diffstat (limited to 'tests/rustdoc')
| -rw-r--r-- | tests/rustdoc/issue-32077-type-alias-impls.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/rustdoc/issue-32077-type-alias-impls.rs b/tests/rustdoc/issue-32077-type-alias-impls.rs index ac486c36ad0..664b678093e 100644 --- a/tests/rustdoc/issue-32077-type-alias-impls.rs +++ b/tests/rustdoc/issue-32077-type-alias-impls.rs @@ -22,7 +22,7 @@ impl Bar for GenericStruct<u32> {} // We check that "Aliased type" is also present as a title in the sidebar. // @has - '//*[@class="sidebar-elems"]//h3/a[@href="#aliased-type"]' 'Aliased type' // We check that we have the implementation of the type alias itself. -// @has - '//*[@id="impl-TypedefStruct"]/h3' 'impl TypedefStruct' +// @has - '//*[@id="impl-GenericStruct%3Cu8%3E"]/h3' 'impl TypedefStruct' // @has - '//*[@id="method.on_alias"]/h4' 'pub fn on_alias()' // @has - '//*[@id="impl-GenericStruct%3CT%3E"]/h3' 'impl<T> GenericStruct<T>' // @has - '//*[@id="method.on_gen"]/h4' 'pub fn on_gen(arg: T)' |
