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
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,16 @@ fn main() {
cmd.arg("-C").arg("target-feature=-crt-static");
}
}

let crate_type = args.windows(2)
.find(|w| &*w[0] == "--crate-type")
.and_then(|w| w[1].to_str());

if let Some("proc-macro") = crate_type {
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.

}

// Force all crates compiled by this compiler to (a) be unstable and (b)
Expand Down