-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow remap-path-prefix in rustdoc #92648
Conversation
Please don't assign me, I'm on vacation. r? rust-lang/rustdoc |
cc @CraftSpider |
@CraftSpider any updates on this review? |
Sorry for the delay. Code looks fine, I'm not sure if there's a better way to test this. I'll ask in the zulip, but if no one has any ideas, I'll likely approve as-is |
It should be possible to write a run-make test for this, I think there's an existing one for rustc. |
Code change looks good. Please add the |
Thanks for the gentle ping. I’m still here, just very low motivation to push this over the finish line right now. |
8090b6e
to
3660bfe
Compare
Alright, so I put a few rustdoc specific things into the existing |
☔ The latest upstream changes (presumably #97239) made this pull request unmergeable. Please resolve the merge conflicts. |
Ping from triage: |
This adds the `--remap-path-prefix` (as an unstable option) to `rustdoc` as well, and passes it down to the rust compiler when compiling doctests. Combined with `--persist-doctests`, the generated executables should have the same resulting paths as the crate artifact itself.
3660bfe
to
832c97b
Compare
@rustbot ready |
@@ -360,6 +360,9 @@ fn run_test( | |||
for debugging_option_str in &rustdoc_options.debugging_opts_strs { | |||
compiler.arg("-Z").arg(&debugging_option_str); | |||
} | |||
for remap_path_prefix_str in &rustdoc_options.remap_path_prefix_strs { | |||
compiler.arg("--remap-path-prefix").arg(&remap_path_prefix_str); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this is the only place you use remap-path-prefix. I think you should also pass it to the compiler options in core.rs
, as well as the options used for parsing doctests.
☔ The latest upstream changes (presumably #98975) made this pull request unmergeable. Please resolve the merge conflicts. |
I believe there are a few ideas around of how to best sanitize paths in rustc in general, so I will probably close this for now until there is more movement in that area. |
This adds the
--remap-path-prefix
(as an unstable option) torustdoc
as well, and passes it down to the rust compiler when compiling doctests.
Combined with
--persist-doctests
, the generated executables shouldhave the same resulting paths as the crate artifact itself.
This is the rustdoc change needed for taiki-e/cargo-llvm-cov#122.
CC @richkadel I tried putting a
--remap-path-prefix
into all the rustc/rustdoc invocations for the coverage tests (and adjusting thellvm-cov --compilation-dir
param), but that resulted inllvm-cov
generating two different sections for the same path (probably because it is treated as different paths internally for whatever reason).However it has the intended effect for the above linked
cargo-llvm-cov
PR.I wonder how I could better test this. Maybe a rustdoc maintainer can help me out here.
r? @jyn514