Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

Swatinem
Copy link
Contributor

@Swatinem Swatinem commented Jan 7, 2022

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.

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 the llvm-cov --compilation-dir param), but that resulted in llvm-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

@rustbot rustbot added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jan 7, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 7, 2022
@jyn514
Copy link
Member

jyn514 commented Jan 7, 2022

Please don't assign me, I'm on vacation.

r? rust-lang/rustdoc

@rust-highfive rust-highfive assigned CraftSpider and unassigned jyn514 Jan 7, 2022
@jyn514
Copy link
Member

jyn514 commented Jan 7, 2022

cc @CraftSpider

@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 23, 2022
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 27, 2022
@Dylan-DPC
Copy link
Member

@CraftSpider any updates on this review?

@CraftSpider
Copy link
Contributor

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

@jyn514
Copy link
Member

jyn514 commented Mar 3, 2022

It should be possible to write a run-make test for this, I think there's an existing one for rustc.

@Dylan-DPC
Copy link
Member

r? @GuillaumeGomez

@GuillaumeGomez
Copy link
Member

Code change looks good. Please add the run-make test as said above and then I'll approve.

@JohnCSimon
Copy link
Member

ping from triage:
@Swatinem
Returning to you to address comments.

FYI: when a PR is ready for review, send a message containing
@rustbot ready to switch to S-waiting-on-review so the PR is in the reviewer's backlog.

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 8, 2022
@Swatinem
Copy link
Contributor Author

Thanks for the gentle ping. I’m still here, just very low motivation to push this over the finish line right now.

@Swatinem Swatinem force-pushed the rustdoc-remap-path branch 2 times, most recently from 8090b6e to 3660bfe Compare May 19, 2022 12:04
@Swatinem
Copy link
Contributor Author

Alright, so I put a few rustdoc specific things into the existing run-make-fulldeps/remap-path-prefix test which was a bit of a hassle.
Also the way DWARF works, I was only able to remap the comp_dir. At least I confirmed with dwarfdump that it did work out.

@bors
Copy link
Contributor

bors commented May 21, 2022

☔ The latest upstream changes (presumably #97239) made this pull request unmergeable. Please resolve the merge conflicts.

@JohnCSimon
Copy link
Member

Ping from triage:
@Swatinem Is this ready for review? Can you please fix the merge conflicts and use @rustbot ready to move this forward?

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.
@Swatinem Swatinem force-pushed the rustdoc-remap-path branch from 3660bfe to 832c97b Compare June 20, 2022 09:38
@Swatinem
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 20, 2022
@@ -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);
Copy link
Member

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.

@bors
Copy link
Contributor

bors commented Jul 14, 2022

☔ The latest upstream changes (presumably #98975) made this pull request unmergeable. Please resolve the merge conflicts.

@Swatinem
Copy link
Contributor Author

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.

@Swatinem Swatinem closed this Jul 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants