rustdoc: Add support for --remap-path-prefix#107099
Conversation
|
(rustbot has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
f42071a to
986d0f4
Compare
986d0f4 to
a65e866
Compare
This comment has been minimized.
This comment has been minimized.
6271d23 to
76e5d16
Compare
|
@rustbot ready |
|
The code looks good to me, but it comes a bit out of the blue so needs the rustdoc team to agree on it (very likely through FCP). But first, what do you think @rust-lang/rustdoc ? |
tests/run-make/issue-88756-default-output/output-default.stdout
Outdated
Show resolved
Hide resolved
My bad! I didn't think this would be a substantial change since |
76e5d16 to
4bf4e60
Compare
|
At least opening an issue to explain your needs so it makes it easier for everyone to reach a solution. If this PR ends up being rejected, you'd have worked for nothing. :-/ |
|
Changes:
|
Got it--I'll be sure to do so in the future. Sorry again, and thank you for the gentle explanation! |
|
@GuillaumeGomez As far as I can tell from the reference to Buck (which I am familiar with) the point of ---- buck-out/v2/gen/fbcode/882bd00a4ffb1e1d/tracing/stats/__tracing_stats__/__srcs/src/lib.rs - StatsLayer (line 70) stdout ----
error[E0433]: failed to resolve: use of undeclared type `StatsLayer`
--> buck-out/v2/gen/fbcode/882bd00a4ffb1e1d/tracing/stats/__tracing_stats__/__srcs/src/lib.rs:71:13
|
3 | let stats = StatsLayer::new("myservice", 8, false)
| ^^^^^^^^^^ not found in this scope
|
help: consider importing this struct
|
2 | use tracing_stats::StatsLayer;
|The build system would want to use ---- tracing/stats/src/lib.rs - StatsLayer (line 70) stdout ----
error[E0433]: failed to resolve: use of undeclared type `StatsLayer`
--> tracing/stats/src/lib.rs:71:13
|
3 | ...It's a common technique for mature build systems to separate the files that get fed to build steps apart from the files that get touched by the programmers. There are many reasons for this; not all of them apply to every build system that uses this technique.
Edward or I would be happy to elaborate on any of the above if needed. |
tests/run-make/issue-88756-default-output/output-default.stdout
Outdated
Show resolved
Hide resolved
4bf4e60 to
b2d37cf
Compare
|
☔ The latest upstream changes (presumably #108096) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@rustbot author |
b2d37cf to
51c1b4f
Compare
|
Hey @KittyBorgX, thanks for the ping. Work has been busy, so the conflicts message slipped through the cracks. Rebased and fixed merge conflicts. @rustbot review |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#107099 (rustdoc: Add support for --remap-path-prefix) - rust-lang#125693 (Format all source files in `tests/coverage/`) - rust-lang#125700 (coverage: Avoid overflow when the MC/DC condition limit is exceeded) - rust-lang#125705 (Reintroduce name resolution check for trying to access locals from an inline const) - rust-lang#125708 (tier 3 target policy: clarify the point about producing assembly) - rust-lang#125715 (remove unneeded extern crate in rmake test) r? `@ghost` `@rustbot` modify labels: rollup
|
☔ The latest upstream changes (presumably #125798) made this pull request unmergeable. Please resolve the merge conflicts. |
Adds --remap-path-prefix as an unstable option. This is implemented to mimic the behavior of rustc's --remap-path-prefix but with minor adjustments. This flag similarly takes in two paths, a prefix to replace and a replacement string.
d66718c to
d9f78cb
Compare
|
Some changes occurred in run-make tests. cc @jieyouxu |
|
Changes:
|
|
Oops, @rustbot ready |
|
Let's try again! @bors r+ rollup |
|
☀️ Test successful - checks-actions |
|
Finished benchmarking commit (6d94a87): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary 2.3%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary -2.3%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: missing data |
Commit 8cf5b3f ("Revert "kbuild, rust: use -fremap-path-prefix to make paths relative"") removed `--remap-path-prefix` from the build system, so the workarounds are not needed anymore. Thus remove them. Note that the flag has landed again in parallel in this cycle in commit dda1350 ("rust: build: remap path to avoid absolute path"), together with `--remap-path-scope=macro` [1]. However, they are gated on `rustc-option-yn, --remap-path-scope=macro`, which means they are both only passed starting with Rust 1.95.0 [2]: `--remap-path-scope` is only stable in Rust 1.95, so use `rustc-option` to detect its presence. This feature has been available as `-Zremap-path-scope` for all versions that we support; however due to bugs in the Rust compiler, it does not work reliably until 1.94. I opted to not enable it for 1.94 as it's just a single version that we missed. In turn, that means the workarounds removed here should not be needed again (even with the flag added again above), since: - `rustdoc` now recognizes the `--remap-path-prefix` flag since Rust 1.81.0 [3] (even if it is still an unstable feature [4]). - The Internal Compiler Error [5] that the comment mentions was fixed in Rust 1.87.0 [6]. We tested that was the case in a previous version of this series by making the workaround conditional [7][8]. ...which are both older versions than Rust 1.95.0. We will still need to skip `--remap-path-scope` for `rustdoc` though, since `rustdoc` does not support that one yet [4]. Link: rust-lang/rust#111540 [1] Link: rust-lang/rust#147611 [2] Link: rust-lang/rust#107099 [3] Link: https://doc.rust-lang.org/nightly/rustdoc/unstable-features.html#--remap-path-prefix-remap-source-code-paths-in-output [4] Link: rust-lang/rust#138520 [5] Link: rust-lang/rust#138556 [6] Link: https://lore.kernel.org/rust-for-linux/20260401114540.30108-9-ojeda@kernel.org/ [7] Link: https://lore.kernel.org/rust-for-linux/20260401114540.30108-10-ojeda@kernel.org/ [8] Acked-by: Gary Guo <gary@garyguo.net> Link: https://patch.msgid.link/20260405235309.418950-2-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Commit 8cf5b3f ("Revert "kbuild, rust: use -fremap-path-prefix to make paths relative"") removed `--remap-path-prefix` from the build system, so the workarounds are not needed anymore. Thus remove them. Note that the flag has landed again in parallel in this cycle in commit dda1350 ("rust: build: remap path to avoid absolute path"), together with `--remap-path-scope=macro` [1]. However, they are gated on `rustc-option-yn, --remap-path-scope=macro`, which means they are both only passed starting with Rust 1.95.0 [2]: `--remap-path-scope` is only stable in Rust 1.95, so use `rustc-option` to detect its presence. This feature has been available as `-Zremap-path-scope` for all versions that we support; however due to bugs in the Rust compiler, it does not work reliably until 1.94. I opted to not enable it for 1.94 as it's just a single version that we missed. In turn, that means the workarounds removed here should not be needed again (even with the flag added again above), since: - `rustdoc` now recognizes the `--remap-path-prefix` flag since Rust 1.81.0 [3] (even if it is still an unstable feature [4]). - The Internal Compiler Error [5] that the comment mentions was fixed in Rust 1.87.0 [6]. We tested that was the case in a previous version of this series by making the workaround conditional [7][8]. ...which are both older versions than Rust 1.95.0. We will still need to skip `--remap-path-scope` for `rustdoc` though, since `rustdoc` does not support that one yet [4]. Link: rust-lang/rust#111540 [1] Link: rust-lang/rust#147611 [2] Link: rust-lang/rust#107099 [3] Link: https://doc.rust-lang.org/nightly/rustdoc/unstable-features.html#--remap-path-prefix-remap-source-code-paths-in-output [4] Link: rust-lang/rust#138520 [5] Link: rust-lang/rust#138556 [6] Link: https://lore.kernel.org/rust-for-linux/20260401114540.30108-9-ojeda@kernel.org/ [7] Link: https://lore.kernel.org/rust-for-linux/20260401114540.30108-10-ojeda@kernel.org/ [8] Link: https://patch.msgid.link/20260405235309.418950-2-ojeda@kernel.org Acked-by: Gary Guo <gary@garyguo.net> Reviewed-by: Tamir Duberstein <tamird@kernel.org> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Adds
--remap-path-prefixas an unstable option. This is implemented to mimic the behavior ofrustc's--remap-path-prefix.This flag similarly takes in two paths, a prefix to replace and a replacement string.
This is useful for build tools (e.g. Buck) other than cargo that can run doc tests.
cc: @dtolnay