Skip to content

Intro of rustc_attr_parsing::attributes::prelude regressed "canonical" paths of certain well-known compiler items in rustdoc search #145870

Closed

Description

@fmease

Important

This is likely an instance of #124608 (solved by rust-lang/rfcs#3011). However it might be worth discussing this recent and concrete regression in isolation.

#145507 (cc @jdonszelmann) introduced rustc_attr_parsing::attributes::prelude which among other things re-exports several "important" / well-known items, namely rustc_span::{DUMMY_SP, Ident, Span, Symbol, sym} (check out https://github.com/rust-lang/rust/blob/d327d651e2583eb601978179f2ca9808f5e243bb/compiler/rustc_attr_parsing/src/attributes/prelude.rs for a complete list (NB: only focus on cross-crate re-exports, not local ones)).

rustdoc-search now considers this prelude to be the "canonical" location of these items. This means that searching for Symbol no longer renders rustc_span::span::Symbol as its first result:

Image

but rustc_attr_parsing::attributes::prelude::Symbol:

Image

To be clear, they still link to the same item, it's just no longer apparent where this item actually comes from. See also:

Image

Activity

  1. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    A-cross-crate-reexportsArea: Documentation that has been re-exported from a different crate
    A-contributor-roadblockArea: Makes things more difficult for new or seasoned contributors to Rust
    C-discussionCategory: Discussion or questions that doesn't represent real issues.
    on Aug 26, 2025
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    T-rustdoc-frontendRelevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
    on Aug 26, 2025
  3. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Aug 26, 2025
  4. fmease commented on Aug 26, 2025

    @fmease
    MemberAuthor

    This isn't a super big deal (since most ppl use IDE auto-import instead of copy/pasting from API docs) but it might confuse new contributors who try to learn the internal compiler surface.

  5. fmease commented on Aug 26, 2025

    @fmease
    MemberAuthor

    #[doc(no_inline)] on these re-exports doesn't help unfortunately, it would make it even worse actually and lead to said path / hyperlink pointing to a non-existing site.

  6. jdonszelmann commented on Aug 26, 2025

    @jdonszelmann
    Contributor

    Huh that's awful.... And it does that despite this module being inaccessible outside rustc_attr_parsing ? Because in most places you can't actually use this path to import these items at all

  7. fmease commented on Aug 26, 2025

    @fmease
    MemberAuthor

    Yea, it's bad. The fact that it's private doesn't really matter here because we document the APIs with --document-private-items, soo

  8. bjorn3 commented on Aug 26, 2025

    @bjorn3
    Member

    Maybe use #[doc(hidden)] for the prelude re-exports? That would also avoid rust-analyzer suggesting something like use rustc_attr_parsing::attributes::prelude::Symbol.

  9. fmease commented on Aug 26, 2025

    @fmease
    MemberAuthor

    Could be worth a try 🤷

  10. jdonszelmann commented on Aug 26, 2025

    @jdonszelmann
    Contributor

    Well within those modules I'd quite like the prelude to work. But I guess it's better than the current situation

  11. added a commit that references this issue on Aug 28, 2025
    b944a43
  12. added a commit that references this issue on Aug 28, 2025
    f100837
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-contributor-roadblockArea: Makes things more difficult for new or seasoned contributors to RustA-cross-crate-reexportsArea: Documentation that has been re-exported from a different crateA-rustdoc-searchArea: Rustdoc's search featureC-discussionCategory: Discussion or questions that doesn't represent real issues.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.T-rustdoc-frontendRelevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions