Skip to content

rustdoc should include aliases in search that only partially matches #140782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Mingun opened this issue May 8, 2025 · 3 comments
Open

rustdoc should include aliases in search that only partially matches #140782

Mingun opened this issue May 8, 2025 · 3 comments
Labels
A-rustdoc-search Area: Rustdoc's search feature T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Comments

@Mingun
Copy link

Mingun commented May 8, 2025

A simple example:

/// Some struct.
#[doc(alias = "SomeAlias")]
pub struct SomeStruct;

I expect that when I search for term "alias" in the generated doc, it will show the corresponding alias, like when I search for term "struct" it shows reference to SomeStruct. Currently you will get the reference only if you type the whole alias in the search field.

Note, that if you enter "some", I would expect that only result for "SomeStruct" is appeared. In other words, the alias should be found by partial match if there is no result for the aliased thing.

Meta

rustc --version --verbose:

rustc 1.86.0 (05f9846f8 2025-03-31)
binary: rustc
commit-hash: 05f9846f893b09a1be1fc8560e33fc3c815cfecb
commit-date: 2025-03-31
host: x86_64-pc-windows-msvc
release: 1.86.0
LLVM version: 19.1.7

This also happens on nightly compiler:

> rustc +nightly --version --verbose
rustc 1.88.0-nightly (e9f8103f9 2025-05-07)
binary: rustc
commit-hash: e9f8103f93f8ce2fa2c15c0c6796ec821f8ae15d
commit-date: 2025-05-07
host: x86_64-pc-windows-msvc
release: 1.88.0-nightly
LLVM version: 20.1.4
@Mingun Mingun added the C-bug Category: This is a bug. label May 8, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 8, 2025
@GuillaumeGomez GuillaumeGomez added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-rustdoc-search Area: Rustdoc's search feature and removed C-bug Category: This is a bug. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels May 9, 2025
@rustbot rustbot added the T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. label May 9, 2025
@GuillaumeGomez
Copy link
Member

It's the expected behaviour: #50146 (comment)

@Mingun
Copy link
Author

Mingun commented May 9, 2025

It seems to me counterintuitive behaviour. You usually doesn't know how exactly the thing is named (that is why you are search) but may expect it will have some strings in it's name. For example, in serde-rs/serde#2922 I've added helper struct, named CowStrVisitor with an alias CowStrSeed and it could be used in contexts where DeserializeSeed implementation is expected. Someone can assume that he can find the appropriate thing by string "seed" in the documentation, but due to this issue that is not the case.

@GuillaumeGomez
Copy link
Member

Yeah agreed. I also think we should apply the same rule as for the rest. Gonna add it to next rustdoc meeting agenda.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-search Area: Rustdoc's search feature T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

No branches or pull requests

3 participants