Skip to content

Commit 0098cd4

Browse files
authored
Rollup merge of #108865 - Zoxc:library-dummy-crate, r=jyn514
Add a `sysroot` crate to represent the standard library crates This adds a dummy crate named `sysroot` to represent the standard library target instead of using the `test` crate. This allows the removal of `proc_macro` as a dependency of `test` allowing these 2 crates to build in parallel saving around 9 seconds locally.
2 parents eac3558 + fd4c81f commit 0098cd4

File tree

10 files changed

+44
-28
lines changed

10 files changed

+44
-28
lines changed

Cargo.lock

+9-1
Original file line numberDiff line numberDiff line change
@@ -4739,6 +4739,15 @@ dependencies = [
47394739
"unicode-xid",
47404740
]
47414741

4742+
[[package]]
4743+
name = "sysroot"
4744+
version = "0.0.0"
4745+
dependencies = [
4746+
"proc_macro",
4747+
"std",
4748+
"test",
4749+
]
4750+
47424751
[[package]]
47434752
name = "tar"
47444753
version = "0.4.38"
@@ -4823,7 +4832,6 @@ dependencies = [
48234832
"getopts",
48244833
"panic_abort",
48254834
"panic_unwind",
4826-
"proc_macro",
48274835
"std",
48284836
]
48294837

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
members = [
33
"compiler/rustc",
44
"library/std",
5-
"library/test",
5+
"library/sysroot",
66
"src/rustdoc-json-types",
77
"src/tools/build_helper",
88
"src/tools/cargotest",

library/sysroot/Cargo.toml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[package]
2+
name = "sysroot"
3+
version = "0.0.0"
4+
edition = "2021"
5+
6+
# this is a dummy crate to ensure that all required crates appear in the sysroot
7+
[dependencies]
8+
proc_macro = { path = "../proc_macro" }
9+
std = { path = "../std" }
10+
test = { path = "../test" }
11+
12+
# Forward features to the `std` crate as necessary
13+
[features]
14+
default = ["std_detect_file_io", "std_detect_dlsym_getauxval", "panic-unwind"]
15+
backtrace = ["std/backtrace"]
16+
compiler-builtins-c = ["std/compiler-builtins-c"]
17+
compiler-builtins-mem = ["std/compiler-builtins-mem"]
18+
compiler-builtins-no-asm = ["std/compiler-builtins-no-asm"]
19+
compiler-builtins-mangled-names = ["std/compiler-builtins-mangled-names"]
20+
llvm-libunwind = ["std/llvm-libunwind"]
21+
system-llvm-libunwind = ["std/system-llvm-libunwind"]
22+
panic-unwind = ["std/panic_unwind"]
23+
panic_immediate_abort = ["std/panic_immediate_abort"]
24+
profiler = ["std/profiler"]
25+
std_detect_file_io = ["std/std_detect_file_io"]
26+
std_detect_dlsym_getauxval = ["std/std_detect_dlsym_getauxval"]
27+
std_detect_env_override = ["std/std_detect_env_override"]

library/sysroot/src/lib.rs

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

library/test/Cargo.toml

-20
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,3 @@ std = { path = "../std" }
1212
core = { path = "../core" }
1313
panic_unwind = { path = "../panic_unwind" }
1414
panic_abort = { path = "../panic_abort" }
15-
16-
# not actually used but needed to always have proc_macro in the sysroot
17-
proc_macro = { path = "../proc_macro" }
18-
19-
# Forward features to the `std` crate as necessary
20-
[features]
21-
default = ["std_detect_file_io", "std_detect_dlsym_getauxval", "panic-unwind"]
22-
backtrace = ["std/backtrace"]
23-
compiler-builtins-c = ["std/compiler-builtins-c"]
24-
compiler-builtins-mem = ["std/compiler-builtins-mem"]
25-
compiler-builtins-no-asm = ["std/compiler-builtins-no-asm"]
26-
compiler-builtins-mangled-names = ["std/compiler-builtins-mangled-names"]
27-
llvm-libunwind = ["std/llvm-libunwind"]
28-
system-llvm-libunwind = ["std/system-llvm-libunwind"]
29-
panic-unwind = ["std/panic_unwind"]
30-
panic_immediate_abort = ["std/panic_immediate_abort"]
31-
profiler = ["std/profiler"]
32-
std_detect_file_io = ["std/std_detect_file_io"]
33-
std_detect_dlsym_getauxval = ["std/std_detect_dlsym_getauxval"]
34-
std_detect_env_override = ["std/std_detect_env_override"]

src/bootstrap/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl Step for Std {
7979
const DEFAULT: bool = true;
8080

8181
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
82-
run.all_krates("test").path("library")
82+
run.all_krates("sysroot").path("library")
8383
}
8484

8585
fn make_run(run: RunConfig<'_>) {

src/bootstrap/clean.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ macro_rules! clean_crate_tree {
8181

8282
clean_crate_tree! {
8383
Rustc, Mode::Rustc, "rustc-main";
84-
Std, Mode::Std, "test";
84+
Std, Mode::Std, "sysroot";
8585
}
8686

8787
fn clean_default(build: &Build, all: bool) {

src/bootstrap/compile.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl Step for Std {
5656
// When downloading stage1, the standard library has already been copied to the sysroot, so
5757
// there's no need to rebuild it.
5858
let builder = run.builder;
59-
run.crate_or_deps("test")
59+
run.crate_or_deps("sysroot")
6060
.path("library")
6161
.lazy_default_condition(Box::new(|| !builder.download_rustc()))
6262
}
@@ -364,7 +364,7 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car
364364
.arg("--features")
365365
.arg(features)
366366
.arg("--manifest-path")
367-
.arg(builder.src.join("library/test/Cargo.toml"));
367+
.arg(builder.src.join("library/sysroot/Cargo.toml"));
368368

369369
// Help the libc crate compile by assisting it in finding various
370370
// sysroot native libraries.

src/bootstrap/doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ impl Step for Std {
438438

439439
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
440440
let builder = run.builder;
441-
run.all_krates("test").path("library").default_condition(builder.config.docs)
441+
run.all_krates("sysroot").path("library").default_condition(builder.config.docs)
442442
}
443443

444444
fn make_run(run: RunConfig<'_>) {

src/bootstrap/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2145,7 +2145,7 @@ impl Step for Crate {
21452145
const DEFAULT: bool = true;
21462146

21472147
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
2148-
run.crate_or_deps("test")
2148+
run.crate_or_deps("sysroot")
21492149
}
21502150

21512151
fn make_run(run: RunConfig<'_>) {

0 commit comments

Comments
 (0)