Skip to content

Conversation

@syphar
Copy link
Member

@syphar syphar commented Nov 1, 2025

So, this is a long-time in progress refactor, partially to reduce a bunch of duplication & inconsistencies around how we handle paths from the URL, but also as preparation for #1853 (subdomain per crate).

parameter parsing

We now have one central axum extractor that can handle everything from very broad routes (just with crate name), to very specific ones (with name, version, target, path), including special-casing needed for static suffixes in routes (like we do for settings.html).

output

  • a storage path for the rustdoc file, with the parameters we have
  • methods for certain rustdoc-specific URLs.

Generally I tried to also convert all the places where we had manual url generation in the templates, into using the new methods.

plan with subdomains

when we later have the subdomain-per-crates, I can "just" change what the extractor looks at, and also provide new target URLs that include the subdomain. And all the generated URLs in all the templates will point to the correct places.

semantic / breaking changes

For that looking at changed tests is best.
mainly:

  • I dediced that I didn't want /index.html for folders in the URL any more
  • some target-redirect URLs will look slightly different

implementation notes:

  • I don't like the PageKind thing in the params, but also didn't have a nicer design idea. I was reluctant to introduce new structs for each kind and then wrap the different behaviour. Taking any recommendations :)
  • there are edge cases / smaller inconsistencies in the RustdocParams builder & parsing structure, specifically when unsetting certain attributes again. I feel like this is still a good state to start with and doesn't hurt the usability, the way the params are used right now.

@syphar syphar self-assigned this Nov 1, 2025
@github-actions github-actions bot added the S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed label Nov 1, 2025
@syphar syphar force-pushed the better-path-split-new-without-separate-params branch 2 times, most recently from ddff565 to b4f93cc Compare November 1, 2025 12:44
@syphar syphar marked this pull request as ready for review November 1, 2025 14:42
@syphar syphar requested a review from a team as a code owner November 1, 2025 14:42
@syphar syphar force-pushed the better-path-split-new-without-separate-params branch from 0e29984 to 282b1bb Compare November 4, 2025 19:07
@syphar syphar merged commit 07e0965 into rust-lang:master Nov 4, 2025
8 checks passed
@github-actions github-actions bot added S-waiting-on-deploy This PR is ready to be merged, but is waiting for an admin to have time to deploy it and removed S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed labels Nov 4, 2025
@syphar syphar deleted the better-path-split-new-without-separate-params branch November 4, 2025 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-deploy This PR is ready to be merged, but is waiting for an admin to have time to deploy it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants