Add a sysroot crate to represent the standard library crates

This commit is contained in:
John Kåre Alsaker 2023-03-07 16:10:29 +01:00
parent 999e6e5afb
commit fd4c81f4c1
10 changed files with 44 additions and 28 deletions

View File

@ -4733,6 +4733,15 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "sysroot"
version = "0.0.0"
dependencies = [
"proc_macro",
"std",
"test",
]
[[package]]
name = "tar"
version = "0.4.38"
@ -4817,7 +4826,6 @@ dependencies = [
"getopts",
"panic_abort",
"panic_unwind",
"proc_macro",
"std",
]

View File

@ -2,7 +2,7 @@
members = [
"compiler/rustc",
"library/std",
"library/test",
"library/sysroot",
"src/rustdoc-json-types",
"src/tools/build_helper",
"src/tools/cargotest",

View File

@ -0,0 +1,27 @@
[package]
name = "sysroot"
version = "0.0.0"
edition = "2021"
# this is a dummy crate to ensure that all required crates appear in the sysroot
[dependencies]
proc_macro = { path = "../proc_macro" }
std = { path = "../std" }
test = { path = "../test" }
# Forward features to the `std` crate as necessary
[features]
default = ["std_detect_file_io", "std_detect_dlsym_getauxval", "panic-unwind"]
backtrace = ["std/backtrace"]
compiler-builtins-c = ["std/compiler-builtins-c"]
compiler-builtins-mem = ["std/compiler-builtins-mem"]
compiler-builtins-no-asm = ["std/compiler-builtins-no-asm"]
compiler-builtins-mangled-names = ["std/compiler-builtins-mangled-names"]
llvm-libunwind = ["std/llvm-libunwind"]
system-llvm-libunwind = ["std/system-llvm-libunwind"]
panic-unwind = ["std/panic_unwind"]
panic_immediate_abort = ["std/panic_immediate_abort"]
profiler = ["std/profiler"]
std_detect_file_io = ["std/std_detect_file_io"]
std_detect_dlsym_getauxval = ["std/std_detect_dlsym_getauxval"]
std_detect_env_override = ["std/std_detect_env_override"]

View File

@ -0,0 +1 @@
// This is intentionally empty since this crate is only used to depend on other library crates.

View File

@ -12,23 +12,3 @@ std = { path = "../std" }
core = { path = "../core" }
panic_unwind = { path = "../panic_unwind" }
panic_abort = { path = "../panic_abort" }
# not actually used but needed to always have proc_macro in the sysroot
proc_macro = { path = "../proc_macro" }
# Forward features to the `std` crate as necessary
[features]
default = ["std_detect_file_io", "std_detect_dlsym_getauxval", "panic-unwind"]
backtrace = ["std/backtrace"]
compiler-builtins-c = ["std/compiler-builtins-c"]
compiler-builtins-mem = ["std/compiler-builtins-mem"]
compiler-builtins-no-asm = ["std/compiler-builtins-no-asm"]
compiler-builtins-mangled-names = ["std/compiler-builtins-mangled-names"]
llvm-libunwind = ["std/llvm-libunwind"]
system-llvm-libunwind = ["std/system-llvm-libunwind"]
panic-unwind = ["std/panic_unwind"]
panic_immediate_abort = ["std/panic_immediate_abort"]
profiler = ["std/profiler"]
std_detect_file_io = ["std/std_detect_file_io"]
std_detect_dlsym_getauxval = ["std/std_detect_dlsym_getauxval"]
std_detect_env_override = ["std/std_detect_env_override"]

View File

@ -79,7 +79,7 @@ impl Step for Std {
const DEFAULT: bool = true;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.all_krates("test").path("library")
run.all_krates("sysroot").path("library")
}
fn make_run(run: RunConfig<'_>) {

View File

@ -81,7 +81,7 @@ macro_rules! clean_crate_tree {
clean_crate_tree! {
Rustc, Mode::Rustc, "rustc-main";
Std, Mode::Std, "test";
Std, Mode::Std, "sysroot";
}
fn clean_default(build: &Build, all: bool) {

View File

@ -56,7 +56,7 @@ impl Step for Std {
// When downloading stage1, the standard library has already been copied to the sysroot, so
// there's no need to rebuild it.
let builder = run.builder;
run.crate_or_deps("test")
run.crate_or_deps("sysroot")
.path("library")
.lazy_default_condition(Box::new(|| !builder.download_rustc()))
}
@ -364,7 +364,7 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car
.arg("--features")
.arg(features)
.arg("--manifest-path")
.arg(builder.src.join("library/test/Cargo.toml"));
.arg(builder.src.join("library/sysroot/Cargo.toml"));
// Help the libc crate compile by assisting it in finding various
// sysroot native libraries.

View File

@ -438,7 +438,7 @@ impl Step for Std {
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
run.all_krates("test").path("library").default_condition(builder.config.docs)
run.all_krates("sysroot").path("library").default_condition(builder.config.docs)
}
fn make_run(run: RunConfig<'_>) {

View File

@ -2163,7 +2163,7 @@ impl Step for Crate {
const DEFAULT: bool = true;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.crate_or_deps("test")
run.crate_or_deps("sysroot")
}
fn make_run(run: RunConfig<'_>) {