Stabilize --remap-path-prefix in rustdoc#155307
Open
Urgau wants to merge 1 commit intorust-lang:mainfrom
Open
Conversation
50 tasks
GuillaumeGomez
approved these changes
Apr 14, 2026
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
Member
|
@rfcbot fcp merge rustdoc-internals |
Collaborator
|
Team member @GuillaumeGomez has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
This comment was marked as outdated.
This comment was marked as outdated.
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.
Stabilization report of
--remap-path-prefixin rustdocSummary
rustcsupports remapping source paths prefixes as a best effort in all compiler generated output, including compiler diagnostics, debugging information, macro expansions, documentation, doctests, etc.This is useful for normalizing build products, for example, by removing the current directory out of the paths emitted into object files.
This stabilization stabilize the same flag used by
rustcinrustdoc.There are no tracking issue.
Stabilization was discussed at the last meeting, #t-rustdoc/meetings > 2026-04-13 @ 💬.
What is stabilized
The rustdoc
--remap-path-scopeflag is being stabilized by this PR. (It's equivalent to rustc flag)It permits remapping (as a best effort) source path prefixes in all output, including diagnostics, debug information, macro expansions, generated documentation, etc.
It takes a value of the form
FROM=TOwhere a path prefix equal toFROMis rewritten to the valueTO.Example
rustdoc src/lib.rs --remap-path-prefix="$PWD=/foo"What isn't stabilized
Neither
--remap-path-scope(soon to be added as unstable inrustdoc) or the already unstable inrustcdocumentationscope are being stabilized or added here.Design
Implementation history
Unresolved questions
There are no unresolved questions.
Post-implementation changes
The implementation has evolved with
rustc, but no changes to the flag it-self have been made.Nightly extensions
The
documentationscope, which currently can only be set fromrustc, as we need to add an equivalent to the--remap-path-scopeflag, which is planned, but not required, the current--remap-path-prefixdefaults to theallscope, likerustc.Doors closed
We are committing to having to having a flag that permits remapping paths. The compiler team already made the same commitment.
Feedback
Call for testing
No call for testing has been done.
Nightly use
Unable to determine. A GitHub search only seems to only reveals the
rustcusage (over 6k though).Rust-for-Linux is using the flag.
Implementation
Major parts
documentationremapping path scope for rustdoc usage #151589Coverage
tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.rstests/rustdoc-ui/remap-path-prefix-invalid-doctest.rstests/rustdoc-ui/remap-path-prefix-macro.rstests/rustdoc-ui/remap-path-prefix-passed-doctest-output.rstests/rustdoc-ui/lints/remap-path-prefix-lint.rstests/rustdoc-html/import-remapped-paths.rstests/rustdoc-html/macro/external-macro-src.rsOutstanding bugs
There are no outstanding bugs regarding
--remap-path-prefixinrustdoc.There are caveats and limitation in
rustc, but they mostly concern generated object files, which we don't really have.Outstanding FIXMEs
There are no FIXME regarding
--remap-path-prefix.Acknowledgments
@rustbot labels +T-rustdoc +F-trim-paths
cc @ojeda (for Rust-for-Linux)
r? rustdoc