Skip to content

[rustdoc search] allow setting crates to search in before showing results #129537

Description

@lolbinarycat

specifically, this would mean moving the #crate-search dropdown so it is available outside of the results screen.

on desktops, it could be moved into the <rustdoc-search> search form, and displayed in a single line. on mobile, it could be displayed directly underneath the search bar line.

this would significantly speed up searching through the nightly-rustc docs when you already know what crate you want to search, although it would require some small refactorings of rustdoc's search.js.

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Aug 25, 2024
  2. notriddle commented on Aug 25, 2024

    @notriddle
    Contributor

    It used to work that way. There are two reasons why it doesn't any more:

    1. less clutter Controls and search in Rustdoc header are visually distracting #59840
    2. less stuff that needs to load Improve loading of crates.js and sidebar-items.js #98124
  3. lolbinarycat commented on Aug 25, 2024

    @lolbinarycat
    ContributorAuthor

    hmm... it might be possible to offset both of those...

    what if it was prerendered, and we hid it behind a setting?

  4. notriddle commented on Aug 25, 2024

    @notriddle
    Contributor

    A better possibility might be to show it when you focus the search box, without requiring you to type anything into it first.

  5. lolbinarycat commented on Aug 25, 2024

    @lolbinarycat
    ContributorAuthor

    yeah, that's actually what i was originally going to suggest for mobile.

    i think that should be doable with just css, actually.

  6. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Aug 25, 2024
  7. notriddle commented on Aug 29, 2025

    @notriddle
    Contributor

    Fixed by #144476

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-searchArea: Rustdoc's search featureT-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