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: Concerns:
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
|
|
🔔 This is now entering its final comment period, as per the review above. 🔔 |
|
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. |
|
@bors r=GuillaumeGomez |
This comment has been minimized.
This comment has been minimized.
…GuillaumeGomez Stabilize `--remap-path-prefix` in rustdoc # 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 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/393423-t-rustdoc.2Fmeetings/topic/2026-04-13/near/585264347). ### What is stabilized The rustdoc `--remap-path-prefix` 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 ```sh 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`~~ #155451) or the already unstable in `rustc` `documentation` scope are being stabilized or added here. ## Design ### Implementation history - #107099 ### 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~~ (EDIT: #155451), 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](https://github.com/search?q=%20%2F--remap-path-prefix%2F&type=code) only seems to only reveals the `rustc` usage (over 6k though). Rust-for-Linux is using the [flag](https://github.com/torvalds/linux/blob/e80d033851b3bc94c3d254ac66660ddd0a49d72c/Makefile#L1151-L1153). ## Implementation ### Major parts - #107099 - #149709 - #150172 - #151589 ### Coverage - [`tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.rs`](https://github.com/rust-lang/rust/blob/12f35ad39ed3e39df4d953c46d4f6cc6c82adc96/tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.rs) - [`tests/rustdoc-ui/remap-path-prefix-invalid-doctest.rs`](https://github.com/rust-lang/rust/blob/12f35ad39ed3e39df4d953c46d4f6cc6c82adc96/tests/rustdoc-ui/remap-path-prefix-invalid-doctest.rs) - [`tests/rustdoc-ui/remap-path-prefix-macro.rs`](https://github.com/rust-lang/rust/blob/12f35ad39ed3e39df4d953c46d4f6cc6c82adc96/tests/rustdoc-ui/remap-path-prefix-macro.rs) - [`tests/rustdoc-ui/remap-path-prefix-passed-doctest-output.rs`](https://github.com/rust-lang/rust/blob/12f35ad39ed3e39df4d953c46d4f6cc6c82adc96/tests/rustdoc-ui/remap-path-prefix-passed-doctest-output.rs) - [`tests/rustdoc-ui/lints/remap-path-prefix-lint.rs`](https://github.com/rust-lang/rust/blob/12f35ad39ed3e39df4d953c46d4f6cc6c82adc96/tests/rustdoc-ui/lints/remap-path-prefix-lint.rs) - [`tests/rustdoc-html/import-remapped-paths.rs`](https://github.com/rust-lang/rust/blob/12f35ad39ed3e39df4d953c46d4f6cc6c82adc96/tests/rustdoc-html/import-remapped-paths.rs) - [`tests/rustdoc-html/macro/external-macro-src.rs`](https://github.com/rust-lang/rust/blob/12f35ad39ed3e39df4d953c46d4f6cc6c82adc96/tests/rustdoc-html/macro/external-macro-src.rs) ### Outstanding bugs There are no outstanding bugs regarding `--remap-path-prefix` in `rustdoc`. There are [caveats and limitation](https://doc.rust-lang.org/nightly/rustc/remap-source-paths.html#caveats-and-limitations) 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 - @edward-shen - @Urgau
…-prefix, r=GuillaumeGomez Stabilize `--remap-path-prefix` in rustdoc # 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 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/393423-t-rustdoc.2Fmeetings/topic/2026-04-13/near/585264347). ### What is stabilized The rustdoc `--remap-path-prefix` 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 ```sh 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`~~ rust-lang#155451) or the already unstable in `rustc` `documentation` scope are being stabilized or added here. ## Design ### Implementation history - rust-lang#107099 ### 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~~ (EDIT: rust-lang#155451), 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](https://github.com/search?q=%20%2F--remap-path-prefix%2F&type=code) only seems to only reveals the `rustc` usage (over 6k though). Rust-for-Linux is using the [flag](https://github.com/torvalds/linux/blob/e80d033851b3bc94c3d254ac66660ddd0a49d72c/Makefile#L1151-L1153). ## Implementation ### Major parts - rust-lang#107099 - rust-lang#149709 - rust-lang#150172 - rust-lang#151589 ### Coverage - [`tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.rs`](https://github.com/rust-lang/rust/blob/12f35ad39ed3e39df4d953c46d4f6cc6c82adc96/tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.rs) - [`tests/rustdoc-ui/remap-path-prefix-invalid-doctest.rs`](https://github.com/rust-lang/rust/blob/12f35ad39ed3e39df4d953c46d4f6cc6c82adc96/tests/rustdoc-ui/remap-path-prefix-invalid-doctest.rs) - [`tests/rustdoc-ui/remap-path-prefix-macro.rs`](https://github.com/rust-lang/rust/blob/12f35ad39ed3e39df4d953c46d4f6cc6c82adc96/tests/rustdoc-ui/remap-path-prefix-macro.rs) - [`tests/rustdoc-ui/remap-path-prefix-passed-doctest-output.rs`](https://github.com/rust-lang/rust/blob/12f35ad39ed3e39df4d953c46d4f6cc6c82adc96/tests/rustdoc-ui/remap-path-prefix-passed-doctest-output.rs) - [`tests/rustdoc-ui/lints/remap-path-prefix-lint.rs`](https://github.com/rust-lang/rust/blob/12f35ad39ed3e39df4d953c46d4f6cc6c82adc96/tests/rustdoc-ui/lints/remap-path-prefix-lint.rs) - [`tests/rustdoc-html/import-remapped-paths.rs`](https://github.com/rust-lang/rust/blob/12f35ad39ed3e39df4d953c46d4f6cc6c82adc96/tests/rustdoc-html/import-remapped-paths.rs) - [`tests/rustdoc-html/macro/external-macro-src.rs`](https://github.com/rust-lang/rust/blob/12f35ad39ed3e39df4d953c46d4f6cc6c82adc96/tests/rustdoc-html/macro/external-macro-src.rs) ### Outstanding bugs There are no outstanding bugs regarding `--remap-path-prefix` in `rustdoc`. There are [caveats and limitation](https://doc.rust-lang.org/nightly/rustc/remap-source-paths.html#caveats-and-limitations) 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 - @edward-shen - @Urgau
|
@bors yield |
|
Auto build was cancelled. Cancelled workflows: The next pull request likely to be tested is #156808. |
This comment has been minimized.
This comment has been minimized.
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing e96c36b (parent) -> 4d276d7 (this PR) Test differencesShow 5 test diffsStage 2
Additionally, 4 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 4d276d7fdba2a24c73dbca3027461bb202e83436 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (4d276d7): comparison URL. Overall result: ❌ regressions - please read:Our benchmarks found a performance regression caused by this PR. Next Steps:
@rustbot label: +perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 2.0%, secondary 2.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 2.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 530.554s -> 511.788s (-3.54%) |
View all comments
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 in#155451) or the already unstable inrustdocrustcdocumentationscope 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(EDIT: #155451), 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