Fix relative extern URL depth on source pages#153160
Open
arferreira wants to merge 1 commit intorust-lang:mainfrom
Open
Fix relative extern URL depth on source pages#153160arferreira wants to merge 1 commit intorust-lang:mainfrom
arferreira wants to merge 1 commit intorust-lang:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
372a8c7 to
d71f355
Compare
notriddle
requested changes
Feb 27, 2026
Collaborator
|
Reminder, once the PR becomes ready for a review, use |
d71f355 to
bfeb902
Compare
This comment has been minimized.
This comment has been minimized.
Contributor
Author
|
@rustbot ready |
This comment has been minimized.
This comment has been minimized.
0f28723 to
6017689
Compare
notriddle
approved these changes
Feb 27, 2026
Contributor
|
@bors r+ |
Contributor
Contributor
|
☔ The latest upstream changes (presumably #153183) made this pull request unmergeable. Please resolve the merge conflicts. This pull request was unapproved. |
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.
Source pages with
--extern-html-root-urlpointing to a relative URL like../were generating links with one extra../. So instead of../../core/iter/index.htmlyou'd get../../../core/iter/index.html. Took a while to notice becausehtmldocck.pyuses substring matching —../../core/is a substring of../../../core/so the test passed anyway.Two root causes.
remote_url_prefixwas usingcx.current.len()for depth, but during source renderingcx.currentis empty —SourceCollectordoesn't do module descent. Source pages live undersrc/<crate_name>/so the real depth is 2, not 0. On top of that,make_hrefwas trying to compensate by prependingroot_pathto relative remote URLs (there was a FIXME about this), which just made it worse —../../+../core/iter/=../../../core/iter/.Fix: added
remote_item_depth(root_path, doc_depth)that counts../segments inroot_pathwhen present, falls back todoc_depthotherwise. With the right depth inremote_url_prefix,make_hrefno longer needs to touch remote URLs at all — sourl_partsnow returnsis_remote = truefor allRemotelocations. Also renamedis_absolute→is_remotesince the semantics were always about "don't modify this URL", not about whether it has a scheme.Added
!hasassertions to the test so the wrong URL gets caught explicitly next time.Follow-up to #152977.
r? @notriddle