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

Fix rustdoc source code rendering for #[path = "../path/to/mod.rs"] links #106466

Merged
merged 2 commits into from
Jan 7, 2023

Conversation

clubby789
Copy link
Contributor

@clubby789 clubby789 commented Jan 4, 2023

Fixes #103517

While generating the location for modules source HTML to be saved at, a .. path component appeared to be translated to /up/.
Additionally, while generating the navigation sidebar, .. path components were ignored. This means that (as in the issue above), a real directory structure of:

sys/
  unix/
    mod.rs  <-- contains #![path = "../unix/mod.rs]
    cmath.rs

was rendered as:

sys/
  unix/
    mod.rs
    unix/
      cmath.rs  <-- links to sys/unix/unix/cmath.rs.html, 404

While the files were stored as

sys/
  unix/
    mod.rs.html
    up/
      unix/
        cmath.rs.html

@rustbot
Copy link
Collaborator

rustbot commented Jan 4, 2023

r? @notriddle

(rustbot has picked a reviewer for you, use r? to override)

@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. labels Jan 4, 2023
@notriddle
Copy link
Contributor

I'm glad to see this fixed, but it introduces broken links to the standard library docs, and it has no test cases.

To write the test cases, use the /src/test/rustdoc folder and the commands described here to query the HTML pages that rustdoc produces.

@clubby789
Copy link
Contributor Author

Looks like this has broken pretty much every other relative link 😅

@rust-log-analyzer

This comment has been minimized.

@clubby789 clubby789 force-pushed the relative-module-fix branch 2 times, most recently from 79bfc53 to cb0c746 Compare January 5, 2023 04:29
@notriddle
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 6, 2023

📌 Commit cb0c7466ad48b337eb3711cf5aa443013096fedd has been approved by notriddle

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 Jan 6, 2023
@clubby789
Copy link
Contributor Author

Cleaned up the Hierarchy traversal a bit since it was a bit overcomplicated

@notriddle
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 6, 2023

📌 Commit d5d1c57 has been approved by notriddle

It is now in the queue for this repository.

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 7, 2023
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#106287 (Add some docs to `bug`, `span_bug` and `delay_span_bug`)
 - rust-lang#106341 (refactor: clean up `errors.rs` and `error_codes_check.rs`)
 - rust-lang#106453 (Improve include macro documentation)
 - rust-lang#106466 (Fix rustdoc source code rendering for `#[path = "../path/to/mod.rs"]` links)
 - rust-lang#106528 (Tiny formatting fix)
 - rust-lang#106534 (rustdoc-gui: Use new block syntax for define-function in goml scripts)
 - rust-lang#106542 (Add default and latest stable edition to --edition in rustc (attempt 2))

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit eb27b61 into rust-lang:master Jan 7, 2023
@rustbot rustbot added this to the 1.68.0 milestone Jan 7, 2023
@clubby789 clubby789 deleted the relative-module-fix branch February 11, 2023 14:46
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dead link in source code browser
5 participants