Skip to content

Do not copy .rmeta files into the sysroot of the build compiler during check of rustc/std #144252

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

Merged
merged 4 commits into from
Aug 19, 2025
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