about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2023-03-07 16:10:29 +0100
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2023-04-25 13:40:36 +0200
commitfd4c81f4c19e3b1eb0710e50e04fb1f980b7e7ab (patch)
tree4f98d6541a9dceacde34a89f156bb588eb60c581
parent999e6e5afb71d0fa6b5f67440278129aca12c67d (diff)
downloadrust-fd4c81f4c19e3b1eb0710e50e04fb1f980b7e7ab.tar.gz
rust-fd4c81f4c19e3b1eb0710e50e04fb1f980b7e7ab.zip
Add a `sysroot` crate to represent the standard library crates
-rw-r--r--Cargo.lock10
-rw-r--r--Cargo.toml2
-rw-r--r--library/sysroot/Cargo.toml27
-rw-r--r--library/sysroot/src/lib.rs1
-rw-r--r--library/test/Cargo.toml20
-rw-r--r--src/bootstrap/check.rs2
-rw-r--r--src/bootstrap/clean.rs2
-rw-r--r--src/bootstrap/compile.rs4
-rw-r--r--src/bootstrap/doc.rs2
-rw-r--r--src/bootstrap/test.rs2
10 files changed, 44 insertions, 28 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 696727c106b..24a185017ed 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4734,6 +4734,15 @@ dependencies = [
 ]
 
 [[package]]
+name = "sysroot"
+version = "0.0.0"
+dependencies = [
+ "proc_macro",
+ "std",
+ "test",
+]
+
+[[package]]
 name = "tar"
 version = "0.4.38"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4817,7 +4826,6 @@ dependencies = [
  "getopts",
  "panic_abort",
  "panic_unwind",
- "proc_macro",
  "std",
 ]
 
diff --git a/Cargo.toml b/Cargo.toml
index a497d7321e0..7aaa34a68e6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,7 +2,7 @@
 members = [
   "compiler/rustc",
   "library/std",
-  "library/test",
+  "library/sysroot",
   "src/rustdoc-json-types",
   "src/tools/build_helper",
   "src/tools/cargotest",
diff --git a/library/sysroot/Cargo.toml b/library/sysroot/Cargo.toml
new file mode 100644
index 00000000000..5356ee277cc
--- /dev/null
+++ b/library/sysroot/Cargo.toml
@@ -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"]
diff --git a/library/sysroot/src/lib.rs b/library/sysroot/src/lib.rs
new file mode 100644
index 00000000000..71ceb580a40
--- /dev/null
+++ b/library/sysroot/src/lib.rs
@@ -0,0 +1 @@
+// This is intentionally empty since this crate is only used to depend on other library crates.
diff --git a/library/test/Cargo.toml b/library/test/Cargo.toml
index 18cb023d274..91a1abde059 100644
--- a/library/test/Cargo.toml
+++ b/library/test/Cargo.toml
@@ -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"]
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
index 60de46ce64c..956b82385f6 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -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<'_>) {
diff --git a/src/bootstrap/clean.rs b/src/bootstrap/clean.rs
index 7ebd0a8f270..0d9fd56b038 100644
--- a/src/bootstrap/clean.rs
+++ b/src/bootstrap/clean.rs
@@ -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) {
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 7d2a6862500..966ae00fa1d 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -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.
diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
index 9ad98eb5702..8f5d9bb66e1 100644
--- a/src/bootstrap/doc.rs
+++ b/src/bootstrap/doc.rs
@@ -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<'_>) {
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 601351ea8e3..38c086b8233 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -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<'_>) {