Skip to content

Stabilize --remap-path-prefix in rustdoc#155307

Open
Urgau wants to merge 1 commit intorust-lang:mainfrom
Urgau:rustdoc-stabilize-remap-path-prefix
Open

Stabilize --remap-path-prefix in rustdoc#155307
Urgau wants to merge 1 commit intorust-lang:mainfrom
Urgau:rustdoc-stabilize-remap-path-prefix

Conversation

@Urgau
Copy link
Copy Markdown
Member

@Urgau Urgau commented Apr 14, 2026

Stabilization report of --remap-path-prefix in rustdoc

Summary

rustc supports 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 rustc in rustdoc.

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-scope flag 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=TO where a path prefix equal to FROM is rewritten to the value TO.

Example

rustdoc src/lib.rs --remap-path-prefix="$PWD=/foo"

What isn't stabilized

Neither --remap-path-scope (soon to be added as unstable in rustdoc) or the already unstable in rustc documentation scope 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 documentation scope, which currently can only be set from rustc, as we need to add an equivalent to the --remap-path-scope flag, which is planned, but not required, the current --remap-path-prefix defaults to the all scope, like rustc.

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 rustc usage (over 6k though).

Rust-for-Linux is using the flag.

Implementation

Major parts

Coverage

Outstanding bugs

There are no outstanding bugs regarding --remap-path-prefix in rustdoc.

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

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. F-trim-paths Feature: trim-paths labels Apr 14, 2026
@GuillaumeGomez GuillaumeGomez removed T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 14, 2026
@GuillaumeGomez

This comment has been minimized.

@GuillaumeGomez

This comment has been minimized.

@Urgau

This comment was marked as outdated.

@rust-rfcbot

This comment was marked as outdated.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Apr 14, 2026
@fmease

This comment has been minimized.

@GuillaumeGomez

This comment has been minimized.

@rust-rfcbot

This comment has been minimized.

@rust-rfcbot rust-rfcbot removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Apr 14, 2026
@GuillaumeGomez

This comment was marked as outdated.

@GuillaumeGomez
Copy link
Copy Markdown
Member

@rfcbot fcp merge rustdoc-internals

@rust-rfcbot
Copy link
Copy Markdown
Collaborator

rust-rfcbot commented Apr 14, 2026

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.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Apr 14, 2026
@fmease fmease added the T-rustdoc-internals Relevant to the rustdoc internals team, which will review and decide on the PR/issue. label Apr 14, 2026
@rust-rfcbot

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-run-make Area: port run-make Makefiles to rmake.rs disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. F-trim-paths Feature: trim-paths proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-internals Relevant to the rustdoc internals team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants