rustdoc-search: show type signature on type-driven SERP #124544
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a rewrite of #117112, based on feedback by @aDotInTheVoid.
This is a draft because of two known issues:
T is t
thing correctly.Preview
Preview page:
Screenshots:
Rationale
Since the point of this feature is to answer the question "why this a match," it's important that it communicates a few things:
This change doesn't touch deduplication. That logic needs some adjusting, but is separate enough from this problem to be done in a different PR.
How it works
A particular source of complexity in this PR is caused by storing the names of type parameters. Since this data is only needed after the results come up, loading them gets delayed until after the search is done, so that they can be loaded at the same time as the descriptions.
Future possibilities
This PR is based on #124148. This feature benefits from the type signature index itself being accurate, so we really kinda need full support for Rust's type grammar.