Skip to content

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

Open
@Mingun

Description

@Mingun

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

Metadata

Metadata

Labels

A-rustdoc-searchArea: Rustdoc's search featureT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.T-rustdoc-frontendRelevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions