Skip to content

rustdoc search: filter by fields on a given type using . #118912

Open
@fmease

Description

@fmease

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).

Footnotes

  1. Structs, tuple structs, enum variant structs and enum variant tuple structs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-searchArea: Rustdoc's search featureC-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions