Improve 404 page for missing rustdoc resources - #3416
Open
kivancgnlp wants to merge 9 commits into
Open
Conversation
Include an empty `recovery` Vec in the about handler's not-found page response. This ensures the response struct has the newly required `recovery` field and prevents missing-field errors after the page/template was extended.
Refactor JSON error response construction to avoid emitting an empty "links" array. The code now builds a base body with title and message and only inserts the "links" field if recovery links are non-empty. Also minor cleanup: clarified the NoResults comment and added braces around the Redirect match arm.
Refactor the match arm for AxumNope::Redirect in crates/bin/docs_rs_web/src/error.rs to a single-line expression calling redirect_with_policy(target, cache_policy). This is a formatting/clarity change only and does not alter behavior.
kivancgnlp
marked this pull request as ready for review
July 23, 2026 13:22
syphar
requested changes
Jul 24, 2026
Author
|
Thanks @syphar. Agreed. |
Member
before I spend more time reviewing this:
I'm ok with people using AI for their contribution, if the author also reviewed & tested everything. |
Address review feedback on rust-lang#2568: clarify the contextual missing-page message and render the recovery links as pure-css action buttons instead of a plain bullet list. JSON error body structure is unchanged.
kivancgnlp
force-pushed
the
fix/contextual-rustdoc-404
branch
from
July 25, 2026 10:03
459832c to
2137e12
Compare
The error page title lives in a `div.container`, which is only centered on the page when the body sets the `centered` class. The error page doesn't, so the title was centered inside a box pinned to the left edge while the message and recovery links below centered against the full page width. Scope the container centering to the error page with an `error-header` class so the title lines up with the text below it, center the recovery links, and give them a small top gap so they read as part of the message rather than running into it.
Author
Member
|
Please add a GUI test then. :) |
Author
|
Thanks for the suggestion. I added a GUI test in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Improves the error page shown when a requested rustdoc resource does not exist in an otherwise valid crate version.
Instead of displaying only a generic 404 page, the response now includes links to:
Fixes #2568.
Changes
ResourceNotFoundInVersionerror variant/latest/and pinned-version URLs when constructing recovery linksNon-goals
This PR intentionally does not:
These can be considered separately if desired.
Testing
AxumErrorPageinitializers updated