Skip to content

Add regression test for #137857 to ensure that we generate intra doc links for extern crate items. #142367

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GuillaumeGomez
Copy link
Member

Fixes #137857.

I checked that linking to extern crates was generating valid links (with the /index.html part) and since it's already working, just adding a regression test.

r? @notriddle

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Jun 11, 2025
@rustbot

This comment has been minimized.

@rust-lang rust-lang deleted a comment from naoNao89 Jun 11, 2025
Copy link
Contributor

@lolbinarycat lolbinarycat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few things I think could be done to improve readability for future maintainers, actual semantics of the test seems correct.

Comment on lines 4 to 8
//@ compile-flags: --document-private-items -Z unstable-options
//@ compile-flags: --extern-html-root-url=empty=https://docs.rs/
// This one is to ensure that we don't link "by default" any item we see which has
// an external html root URL.
//@ compile-flags: --extern-html-root-url=non_existent=https://docs.rs/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//@ compile-flags: --document-private-items -Z unstable-options
//@ compile-flags: --extern-html-root-url=empty=https://docs.rs/
// This one is to ensure that we don't link "by default" any item we see which has
// an external html root URL.
//@ compile-flags: --extern-html-root-url=non_existent=https://docs.rs/
//@ compile-flags: --document-private-items -Z unstable-options
//@ compile-flags: --extern-html-root-url=empty=https://empty.example/
// This one is to ensure that we don't link to any item we see which has
// an external html root URL unless it actually exists
//@ compile-flags: --extern-html-root-url=non_existent=https://non-existant.example/

I think it is confusing to give a value that is similar to a real value, but which is incorrect if you wanted the link to actually work.
Using obvious placeholder values should hopefully be more clear (.example in particular is reserved as a gTLD that will never actually be used)

@GuillaumeGomez GuillaumeGomez force-pushed the extern-crate-items-intra-doc branch from 7b345fa to 1c6b2d4 Compare June 13, 2025 14:02
@rustbot
Copy link
Collaborator

rustbot commented Jun 13, 2025

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@GuillaumeGomez
Copy link
Member Author

Applied suggestions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rust docs: Crate root link points to "folder" and not index page
4 participants