Skip to content
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

Compile core crates before std #51440

Closed
wants to merge 6 commits into from
Closed
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
37 changes: 0 additions & 37 deletions src/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@ version = "0.0.0"
dependencies = [
"build_helper 0.1.0",
"cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.0.0",
"core 0.0.0",
"libc 0.0.0",
]

[[package]]
name = "alloc_system"
version = "0.0.0"
dependencies = [
"compiler_builtins 0.0.0",
"core 0.0.0",
"dlmalloc 0.0.0",
"libc 0.0.0",
]
Expand Down Expand Up @@ -598,10 +594,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "dlmalloc"
version = "0.0.0"
dependencies = [
"compiler_builtins 0.0.0",
"core 0.0.0",
]

[[package]]
name = "dtoa"
Expand Down Expand Up @@ -1060,10 +1052,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
version = "0.0.0"
dependencies = [
"compiler_builtins 0.0.0",
"core 0.0.0",
]

[[package]]
name = "libc"
Expand Down Expand Up @@ -1350,18 +1338,13 @@ dependencies = [
name = "panic_abort"
version = "0.0.0"
dependencies = [
"compiler_builtins 0.0.0",
"core 0.0.0",
"libc 0.0.0",
]

[[package]]
name = "panic_unwind"
version = "0.0.0"
dependencies = [
"alloc 0.0.0",
"compiler_builtins 0.0.0",
"core 0.0.0",
"libc 0.0.0",
"unwind 0.0.0",
]
Expand Down Expand Up @@ -1501,8 +1484,6 @@ name = "profiler_builtins"
version = "0.0.0"
dependencies = [
"cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.0.0",
"core 0.0.0",
]

[[package]]
Expand Down Expand Up @@ -2054,12 +2035,9 @@ dependencies = [
name = "rustc_asan"
version = "0.0.0"
dependencies = [
"alloc 0.0.0",
"alloc_system 0.0.0",
"build_helper 0.1.0",
"cmake 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.0.0",
"core 0.0.0",
]

[[package]]
Expand Down Expand Up @@ -2235,12 +2213,9 @@ dependencies = [
name = "rustc_lsan"
version = "0.0.0"
dependencies = [
"alloc 0.0.0",
"alloc_system 0.0.0",
"build_helper 0.1.0",
"cmake 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.0.0",
"core 0.0.0",
]

[[package]]
Expand Down Expand Up @@ -2286,12 +2261,9 @@ dependencies = [
name = "rustc_msan"
version = "0.0.0"
dependencies = [
"alloc 0.0.0",
"alloc_system 0.0.0",
"build_helper 0.1.0",
"cmake 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.0.0",
"core 0.0.0",
]

[[package]]
Expand Down Expand Up @@ -2390,12 +2362,9 @@ dependencies = [
name = "rustc_tsan"
version = "0.0.0"
dependencies = [
"alloc 0.0.0",
"alloc_system 0.0.0",
"build_helper 0.1.0",
"cmake 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.0.0",
"core 0.0.0",
]

[[package]]
Expand Down Expand Up @@ -2632,13 +2601,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "std"
version = "0.0.0"
dependencies = [
"alloc 0.0.0",
"alloc_jemalloc 0.0.0",
"alloc_system 0.0.0",
"build_helper 0.1.0",
"cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.0.0",
"core 0.0.0",
"libc 0.0.0",
"panic_abort 0.0.0",
"panic_unwind 0.0.0",
Expand All @@ -2648,7 +2614,6 @@ dependencies = [
"rustc_lsan 0.0.0",
"rustc_msan 0.0.0",
"rustc_tsan 0.0.0",
"std_unicode 0.0.0",
"unwind 0.0.0",
]

Expand Down Expand Up @@ -3037,8 +3002,6 @@ dependencies = [
name = "unwind"
version = "0.0.0"
dependencies = [
"compiler_builtins 0.0.0",
"core 0.0.0",
"libc 0.0.0",
]

Expand Down
3 changes: 3 additions & 0 deletions src/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[workspace]
members = [
"bootstrap",
"libcore",
"libstd_unicode",
"liballoc",
"rustc",
"libstd",
"libtest",
Expand Down
31 changes: 26 additions & 5 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

//! Implementation of compiling the compiler and standard library, in "check" mode.

use compile::{run_cargo, std_cargo, test_cargo, rustc_cargo, rustc_cargo_env, add_to_sysroot};
use compile::{run_cargo, core_cargo, std_cargo, test_cargo,
rustc_cargo, rustc_cargo_env, add_to_sysroot};
use builder::{RunConfig, Builder, ShouldRun, Step};
use tool::{self, prepare_tool_cargo};
use {Compiler, Mode};
Expand All @@ -28,6 +29,10 @@ impl Step for Std {

fn should_run(run: ShouldRun) -> ShouldRun {
run.all_krates("std")
.path("src/libcore")
.path("src/liballoc")
.path("src/libstd_unicode")
.path("src/rustc/compiler_builtins_shim")
}

fn make_run(run: RunConfig) {
Expand All @@ -43,17 +48,25 @@ impl Step for Std {
let out_dir = builder.stage_out(compiler, Mode::Std);
builder.clear_if_dirty(&out_dir, &builder.rustc(compiler));

let mut cargo = builder.cargo(compiler, Mode::Std, target, "check");
std_cargo(builder, &compiler, target, &mut cargo);
let mut core_cargo_invoc = builder.cargo(compiler, Mode::Std, target, "check");
core_cargo(builder, &compiler, target, &mut core_cargo_invoc);
let mut std_cargo_invoc = builder.cargo(compiler, Mode::Std, target, "check");
std_cargo(builder, &compiler, target, &mut std_cargo_invoc);

let _folder = builder.fold_output(|| format!("stage{}-std", compiler.stage));
let libdir = builder.sysroot_libdir(compiler, target);

println!("Checking std artifacts ({} -> {})", &compiler.host, target);
run_cargo(builder,
&mut cargo,
&mut core_cargo_invoc,
&libcore_stamp(builder, compiler, target),
true);
add_to_sysroot(&builder, &libdir, &libcore_stamp(builder, compiler, target));
run_cargo(builder,
&mut std_cargo_invoc,
&libstd_stamp(builder, compiler, target),
true);

let libdir = builder.sysroot_libdir(compiler, target);
add_to_sysroot(&builder, &libdir, &libstd_stamp(builder, compiler, target));
}
}
Expand Down Expand Up @@ -88,6 +101,7 @@ impl Step for Rustc {
let target = self.target;

let stage_out = builder.stage_out(compiler, Mode::Rustc);
builder.clear_if_dirty(&stage_out, &libcore_stamp(builder, compiler, target));
builder.clear_if_dirty(&stage_out, &libstd_stamp(builder, compiler, target));
builder.clear_if_dirty(&stage_out, &libtest_stamp(builder, compiler, target));

Expand Down Expand Up @@ -176,6 +190,7 @@ impl Step for Test {
let target = self.target;

let out_dir = builder.stage_out(compiler, Mode::Test);
builder.clear_if_dirty(&out_dir, &libcore_stamp(builder, compiler, target));
builder.clear_if_dirty(&out_dir, &libstd_stamp(builder, compiler, target));

let mut cargo = builder.cargo(compiler, Mode::Test, target, "check");
Expand Down Expand Up @@ -242,6 +257,12 @@ impl Step for Rustdoc {
}
}

/// Cargo's output path for the core library in a given stage, compiled
/// by a particular compiler for the specified target.
pub fn libcore_stamp(builder: &Builder, compiler: Compiler, target: Interned<String>) -> PathBuf {
builder.cargo_out(compiler, Mode::Std, target).join(".libcore-check.stamp")
}

/// Cargo's output path for the standard library in a given stage, compiled
/// by a particular compiler for the specified target.
pub fn libstd_stamp(builder: &Builder, compiler: Compiler, target: Interned<String>) -> PathBuf {
Expand Down
Loading