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

[WIP]: Remove libbacktrace #51408

Closed
wants to merge 10 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
218 changes: 158 additions & 60 deletions src/Cargo.lock

Large diffs are not rendered by default.

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
11 changes: 9 additions & 2 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ impl<'a> Builder<'a> {
} else {
&self.config.channel
};
cargo.env("__CARGO_DEFAULT_LIB_METADATA", &metadata);
cargo.env("__CARGO_DEFAULT_LIB_METADATA", &format!("{}-{}", metadata, mode.as_str()));

let stage;
if compiler.stage == 0 && self.local_rebuild {
Expand Down Expand Up @@ -838,7 +838,14 @@ impl<'a> Builder<'a> {
// already-passed -C metadata flag with our own. Our rustc.rs
// wrapper around the actual rustc will detect -C metadata being
// passed and frob it with this extra string we're passing in.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the wording above was correct where the compiler was the only crate graph depending on crates.io, but since now std itself also does that, we need to apply this metadata mangling to differ std's and rustc's symbols as well. Let me know if you want further explanation or you think that's enough to update the wording.

cargo.env("RUSTC_METADATA_SUFFIX", "rustc");
let suffix = match mode {
Mode::Std => "rustc-std",
Mode::Test => "rustc-test",
Mode::Codegen => "rustc-codegen",
Mode::Rustc => "rustc-rustc",
Mode::ToolStd | Mode::ToolTest | Mode::ToolRustc => "rustc-tools",
};
cargo.env("RUSTC_METADATA_SUFFIX", suffix);
}

if let Some(x) = self.crt_static(target) {
Expand Down
27 changes: 22 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 Down Expand Up @@ -43,17 +44,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 +97,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 +186,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 +253,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