Skip to content

Add support for "{target}" to the --extern-html-root-url cargo passes to rustdoc (through doc.extern-map.registries) #9578

Open
@jyn514

Description

@jyn514

Describe the problem you are trying to solve
docs.rs would like to link to builds for specific targets, since not all targets have the same documentation: rust-lang/docs.rs#1397 (comment). However, this requires more flexibility in the URL than cargo currently allows. It would be great if -Zrustdoc-map added support for this so we don't have to go back to adding --extern-html-root-url by hand (which was quite buggy).

Describe the solution you'd like
Add support for {target} to doc.extern-map.registries. It should have the following behavior:

  1. When using cargo doc --target x, replace {target} with x in the remapping.
  2. When using cargo doc alone, without --target, remove {target} altogether.

I don't have strong opinions on 2 (docs.rs will work even if it's replaced with the host target) but it seems like a reasonable behavior.

Notes

I am interested in implementing this myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-triageStatus: This issue is waiting on initial triage.Z-rustdoc-mapNightly: rustdoc-map

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions