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

Remap paths for proc-macro crates. #63558

Merged
merged 2 commits into from
Aug 17, 2019
Merged

Conversation

jgalenson
Copy link

The remap-debuginfo config option remaps paths in most crates, but it does not apply to proc-macros, so they are still non-reproducible. This patch fixes that.

I'm not completely sure if this is the best way to do this, but to get reproducible builds we need librustc_macros to be built with --remap-path-prefix. I was previously modifying Cargo to pass that argument to all child crates, so this seems simpler and more correct.

I did not add a test since there do not seem to be any existing tests for RUSTC_DEBUGINFO_MAP.

r? @alexcrichton

The remap-debuginfo config option remaps paths in most crates, but it
does not apply to proc-macros, so they are still non-reproducible.
This patch fixes that.
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 14, 2019
if let Ok(map) = env::var("RUSTC_DEBUGINFO_MAP") {
cmd.arg("--remap-path-prefix").arg(&map);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing this just for proc macro crates, can we just universally pass the remap to all invocations of rustc? We already do so earlier in this file if target.is_some(), I'd like to not duplicate that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would certainly be fine with me. I did it this way to apply the change to as few crates as possible to be safe, but if it's correct that is indeed cleaner.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear, I don't know why we're not already doing that (maybe just by accident).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like doing it this way does help make other crates reproducible (e.g., plugins like rust-clippy), so I'll do it that way.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Aug 14, 2019

📌 Commit 9e2d02a has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 14, 2019
@Centril
Copy link
Contributor

Centril commented Aug 16, 2019

@bors p=1

Centril added a commit to Centril/rust that referenced this pull request Aug 16, 2019
Remap paths for proc-macro crates.

The remap-debuginfo config option remaps paths in most crates, but it does not apply to proc-macros, so they are still non-reproducible.  This patch fixes that.

I'm not completely sure if this is the best way to do this, but to get reproducible builds we need librustc_macros to be built with --remap-path-prefix.  I was previously modifying Cargo to pass that argument to all child crates, so this seems simpler and more correct.

I did not add a test since there do not seem to be any existing tests for RUSTC_DEBUGINFO_MAP.

r? @alexcrichton
Centril added a commit to Centril/rust that referenced this pull request Aug 17, 2019
Remap paths for proc-macro crates.

The remap-debuginfo config option remaps paths in most crates, but it does not apply to proc-macros, so they are still non-reproducible.  This patch fixes that.

I'm not completely sure if this is the best way to do this, but to get reproducible builds we need librustc_macros to be built with --remap-path-prefix.  I was previously modifying Cargo to pass that argument to all child crates, so this seems simpler and more correct.

I did not add a test since there do not seem to be any existing tests for RUSTC_DEBUGINFO_MAP.

r? @alexcrichton
bors added a commit that referenced this pull request Aug 17, 2019
Rollup of 6 pull requests

Successful merges:

 - #63149 (resolve: Populate external modules in more automatic and lazy way)
 - #63545 (Feature gate 'yield $expr?' pre-expansion)
 - #63548 (Update rustc-demangle to 0.1.16.)
 - #63558 (Remap paths for proc-macro crates.)
 - #63641 (add git keyword to submodule comments in config.example.toml)
 - #63642 (Rename overflowing_{add,sub,mul} intrinsics to wrapping_{add,sub,mul}.)

Failed merges:

r? @ghost
@bors bors merged commit 9e2d02a into rust-lang:master Aug 17, 2019
@jgalenson jgalenson deleted the move-remap branch August 17, 2019 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants