Stabilize --remap-path-prefix in rustdoc#155307
Conversation
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.
|
@rfcbot fcp merge rustdoc-internals |
|
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.
|
there seems to be a bit of an issue in the description
|
|
Sorry about that, I based this report on the one I did for the scope variant in the compiler. Fixed. |
|
☔ The latest upstream changes (presumably #155380) made this pull request unmergeable. Please resolve the merge conflicts. |
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-prefixflag 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