-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Conversation
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.
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. |
src/bootstrap/bin/rustc.rs
Outdated
if let Ok(map) = env::var("RUSTC_DEBUGINFO_MAP") { | ||
cmd.arg("--remap-path-prefix").arg(&map); | ||
} | ||
} |
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.
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.
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.
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.
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.
To be clear, I don't know why we're not already doing that (maybe just by accident).
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 doing it this way does help make other crates reproducible (e.g., plugins like rust-clippy), so I'll do it that way.
@bors: r+ |
📌 Commit 9e2d02a has been approved by |
@bors p=1 |
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
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
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
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