Skip to content
Merged
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
10 changes: 10 additions & 0 deletions src/bootstrap/src/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ fn main() {
}
}

// Here we pass additional paths that essentially act as a sysroot.
// These are used to load rustc crates (e.g. `extern crate rustc_ast;`)
// for rustc_private tools, so that we do not have to copy them into the
// actual sysroot of the compiler that builds the tool.
if let Ok(dirs) = env::var("RUSTC_ADDITIONAL_SYSROOT_PATHS") {
for dir in dirs.split(",") {
cmd.arg(format!("-L{dir}"));
}
}
Comment on lines +182 to +190
Copy link
Member

Choose a reason for hiding this comment

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

Remark: in theory, this can break if dir name has a comma. In practice, simply don't do that.

Copy link
Member Author

Choose a reason for hiding this comment

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

If someone comes with that use-case, we can always switch to some different encoding, e.g. a zero byte.


// Force all crates compiled by this compiler to (a) be unstable and (b)
// allow the `rustc_private` feature to link to other unstable crates
// also in the sysroot. We also do this for host crates, since those
Expand Down
Loading
Loading