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

Merged
merged 1 commit into from
Jun 29, 2025

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

This comment has been minimized.

@GuillaumeGomez
Copy link
Member Author

Applied suggestions!

@GuillaumeGomez GuillaumeGomez force-pushed the extern-crate-items-intra-doc branch from 1c6b2d4 to 1052ddd Compare June 28, 2025 09:27
@rustbot
Copy link
Collaborator

rustbot commented Jun 28, 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 suggestion (updated comment and updated URL).

@GuillaumeGomez
Copy link
Member Author

@bors r=lolbinarycat rollup

@bors
Copy link
Collaborator

bors commented Jun 28, 2025

📌 Commit 1052ddd has been approved by lolbinarycat

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 28, 2025
bors added a commit that referenced this pull request Jun 29, 2025
Rollup of 11 pull requests

Successful merges:

 - #142021 (Doc: clarify priority of lint level sources)
 - #142367 (Add regression test for #137857 to ensure that we generate intra doc links for extern crate items.)
 - #142641 (Generate symbols.o for proc-macros too)
 - #142889 (Clarify doc comment on unix OpenOptions)
 - #143063 (explain `ImportData::imported_module`)
 - #143088 (Improve documentation of `TagEncoding`)
 - #143135 (fix typos on some doc comments)
 - #143138 (Port `#[link_name]` to the new attribute parsing infrastructure)
 - #143155 (`librustdoc` house-keeping 🧹)
 - #143169 (Remove unused feature gates)
 - #143171 (Fix the span of trait bound modifier `[const]`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e5bd07a into rust-lang:master Jun 29, 2025
10 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jun 29, 2025
rust-timer added a commit that referenced this pull request Jun 29, 2025
Rollup merge of #142367 - GuillaumeGomez:extern-crate-items-intra-doc, r=lolbinarycat

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

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`
@GuillaumeGomez GuillaumeGomez deleted the extern-crate-items-intra-doc branch June 29, 2025 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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
5 participants