Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc-search: add impl disambiguator to duplicate assoc items #109422

Merged
merged 5 commits into from Oct 10, 2023

Commits on Sep 21, 2023

  1. Copy the full SHA
    9683f8a View commit details
    Browse the repository at this point in the history
  2. rustdoc-search: add impl disambiguator to duplicate assoc items

    Helps with rust-lang#90929
    
    This changes the search results, specifically, when there's more than
    one impl with an associated item with the same name. For example,
    the search queries `simd<i8> -> simd<i8>` and `simd<i64> -> simd<i64>`
    don't link to the same function, but most of the functions have the
    same names.
    
    This change should probably be FCP-ed, especially since it adds a new
    anchor link format for `main.js` to handle, so that URLs like
    `struct.Vec.html#impl-AsMut<[T]>-for-Vec<T,+A>/method.as_mut` redirect
    to `struct.Vec.html#method.as_mut-2`. It's a strange design, but there
    are a few reasons for it:
    
    * I'd like to avoid making the HTML bigger. Obviously, fixing this bug
      is going to add at least a little more data to the search index, but
      adding more HTML penalises viewers for the benefit of searchers.
    
    * Breaking `struct.Vec.html#method.len` would also be a disappointment.
    
    On the other hand:
    
    * The path-style anchors might be less prone to link rot than the numbered
      anchors. It's definitely less likely to have URLs that appear to "work",
      but silently point at the wrong thing.
    
    * This commit arranges the path-style anchor to redirect to the numbered
      anchor. Nothing stops rustdoc from doing the opposite, making path-style
      anchors the default and redirecting the "legacy" numbered ones.
    notriddle committed Sep 21, 2023
    Copy the full SHA
    3fbfe2b View commit details
    Browse the repository at this point in the history
  3. rustdoc: update test cases for changes to the printing style

    This whole thing changes it so that the JS and the UI both use
    rustc's own path printing to handle the impl IDs. This results in
    the format changing a little bit; full paths are used in spots
    where they aren't strictly necessary, and the path sometimes uses
    generics where the old system used the trait's own name, but it
    shouldn't matter since the orphan rules will prevent it anyway.
    notriddle committed Sep 21, 2023
    Copy the full SHA
    3583e86 View commit details
    Browse the repository at this point in the history
  4. rustdoc: wait for section to open before trying to highlight

    This fixes a problem where hash rewriting doesn't work with
    `:target` CSS rules.
    notriddle committed Sep 21, 2023
    Copy the full SHA
    20b93b9 View commit details
    Browse the repository at this point in the history
  5. Copy the full SHA
    2a4c9d0 View commit details
    Browse the repository at this point in the history