Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 11 additions & 0 deletions src/bootstrap/src/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@ fn main() {
};
cmd.args(&args).env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());

let rustc_source_dir = env::var_os("RUSTC_SOURCE_DIR").unwrap();
let workspace_prefix =
if let Ok(prefix) = env::current_dir().unwrap().strip_prefix(&rustc_source_dir) {
prefix.to_owned()
} else {
PathBuf::from(".")
Copy link
Member

Choose a reason for hiding this comment

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

What does a =. remap even do? Wouldn't it make more sense to only add --remap-path-prefix if strip_prefix succeeds?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a leftover from a different attempt at fixing this issue. It should indeed skip --remap-path-prefix in this case.

};

cmd.arg("--remap-path-prefix");
cmd.arg(format!("={}", workspace_prefix.display()));

// Get the name of the crate we're compiling, if any.
let crate_name = parse_value_from_args(&orig_args, "--crate-name");

Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/src/core/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1794,7 +1794,8 @@ impl<'a> Builder<'a> {
.env("RUSTDOC", self.bootstrap_out.join("rustdoc"))
.env("RUSTDOC_REAL", rustdoc_path)
.env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir())
.env("RUSTC_BREAK_ON_ICE", "1");
.env("RUSTC_BREAK_ON_ICE", "1")
.env("RUSTC_SOURCE_DIR", &self.src);

// Set RUSTC_WRAPPER to the bootstrap shim, which switches between beta and in-tree
// sysroot depending on whether we're building build scripts.
Expand Down
Loading