rustdoc search: filter by fields on a given type using `.`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I've caught myself many times trying to search for fields on a specific type by entering search queries like tyctxt.types, only to be greeted by Query parser error: "Unexpected .".
I'd love rustdoc to find all fields named field defined (directly or indirectly via Deref) on “record types”[^1] matching path path given the input path.field.
For example, let's assume we are over at rustc's API docs and the query is tyctxt.types. Then, I'd expect rustdoc to find & link to rustc_middle::ty::context::GlobalCtxt.types (TyCtxt derefs to GlobalCtxt).
We could even think about extending this feature to cover path.field.subfield in the future which would denote (pseudo) ⟨typeof ⟦path.field⟧⟩.subfield, although that'd probably be quite hairy to implement performantly.
Related: #88660 (“item” kind filter field).
[^1]: Structs, tuple structs, enum variant structs and enum variant tuple structs.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining rustdoc's search query parser and the field-filter work referenced in #88660. Determine how path.field should resolve direct and Deref-provided fields on the listed record types, then verify that matching documentation links are produced and malformed queries remain handled correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation, search
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100