Skip to content
Merged
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
12 changes: 6 additions & 6 deletions src/bootstrap/src/cli_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::{env, process};
use crate::core::builder::StepStack;
use crate::core::config::flags::{Flags, Subcommand};
use crate::core::config::{ChangeId, Config};
use crate::core::session::Build;
use crate::core::session::Session;
use crate::debug;
use crate::utils::change_tracker::{
CONFIG_CHANGE_HISTORY, find_recent_config_change_ids, human_readable_changes,
Expand Down Expand Up @@ -157,9 +157,9 @@ pub fn main() {
t!(symlink_dir_inner(&tracing_dir, &latest_trace_dir));
}

debug!("creating new build based on config");
let mut build = Build::new(config);
build.build();
debug!("creating new session based on config");
let mut sess = Session::new(config);
sess.build();

if suggest_setup {
println!("WARNING: you have not made a `bootstrap.toml`");
Expand Down Expand Up @@ -213,8 +213,8 @@ pub fn main() {

#[cfg(feature = "tracing")]
{
build.report_summary(&tracing_dir.join("command-stats.txt"), _start_time);
build.report_step_graph(&tracing_dir);
sess.report_summary(&tracing_dir.join("command-stats.txt"), _start_time);
sess.report_step_graph(&tracing_dir);
guard.copy_to_dir(&tracing_dir);
eprintln!("Tracing/profiling output has been written to {}", latest_trace_dir.display());
}
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ impl CommandLineStep for GccCodegenBackend {

fn run(self, builder: &Builder<'_>) {
// FIXME: remove once https://github.com/rust-lang/rust/issues/112393 is resolved
if builder.build.config.vendor {
if builder.sess.config.vendor {
println!("Skipping checking of `rustc_codegen_gcc` with vendoring enabled.");
return;
}
Expand Down
36 changes: 18 additions & 18 deletions src/bootstrap/src/core/build_steps/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::core::builder::{
};
use crate::core::compiler::Compiler;
use crate::core::config::flags::Subcommand;
use crate::core::session::{Build, Mode};
use crate::core::session::{Mode, Session};
use crate::utils::build_stamp::BuildStamp;
use crate::utils::helpers::t;

Expand Down Expand Up @@ -47,7 +47,7 @@ impl CommandLineStep for CleanAll {
panic!("--all and --stage can't be used at the same time for `x clean`");
}

clean(builder.build, all, stage)
clean(builder.sess, all, stage)
}
}

Expand Down Expand Up @@ -105,32 +105,32 @@ clean_crate_tree! {
Std, Mode::Std, "sysroot";
}

fn clean(build: &Build, all: bool, stage: Option<u32>) {
if build.config.dry_run() {
fn clean(sess: &Session, all: bool, stage: Option<u32>) {
if sess.config.dry_run() {
return;
}

rm_rf("tmp".as_ref());

// Clean the entire build directory
if all {
rm_rf(&build.out);
rm_rf(&sess.out);
return;
}

// Clean the target stage artifacts
if let Some(stage) = stage {
clean_specific_stage(build, stage);
clean_specific_stage(sess, stage);
return;
}

// Follow the default behaviour
clean_default(build);
clean_default(sess);
}

fn clean_specific_stage(build: &Build, stage: u32) {
for host in &build.hosts {
let entries = match build.out.join(host).read_dir() {
fn clean_specific_stage(sess: &Session, stage: u32) {
for host in &sess.hosts {
let entries = match sess.out.join(host).read_dir() {
Ok(iter) => iter,
Err(_) => continue,
};
Expand All @@ -150,18 +150,18 @@ fn clean_specific_stage(build: &Build, stage: u32) {
}
}

fn clean_default(build: &Build) {
rm_rf(&build.out.join("tmp"));
rm_rf(&build.out.join("dist"));
rm_rf(&build.out.join("bootstrap").join(".last-warned-change-id"));
rm_rf(&build.out.join("bootstrap-shims-dump"));
rm_rf(BuildStamp::new(&build.out).with_prefix("rustfmt").path());
fn clean_default(sess: &Session) {
rm_rf(&sess.out.join("tmp"));
rm_rf(&sess.out.join("dist"));
rm_rf(&sess.out.join("bootstrap").join(".last-warned-change-id"));
rm_rf(&sess.out.join("bootstrap-shims-dump"));
rm_rf(BuildStamp::new(&sess.out).with_prefix("rustfmt").path());

let mut hosts: Vec<_> = build.hosts.iter().map(|t| build.out.join(t)).collect();
let mut hosts: Vec<_> = sess.hosts.iter().map(|t| sess.out.join(t)).collect();
// After cross-compilation, artifacts of the host architecture (which may differ from build.host)
// might not get removed.
// Adding its path (linked one for easier accessibility) will solve this problem.
hosts.push(build.out.join("host"));
hosts.push(sess.out.join("host"));

for host in hosts {
let entries = match host.read_dir() {
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ impl Step for StdLink {
};

let is_downloaded_beta_stage0 = builder
.build
.sess
.config
.initial_rustc
.starts_with(builder.out.join(compiler.host).join("stage0/bin"));
Expand Down Expand Up @@ -1147,7 +1147,7 @@ impl CommandLineStep for Rustc {
cargo.arg("-p").arg(krate);
}

if builder.build.config.enable_bolt_settings && build_compiler.stage == 1 {
if builder.sess.config.enable_bolt_settings && build_compiler.stage == 1 {
// Relocations are required for BOLT to work.
cargo.env("RUSTC_BOLT_LINK_FLAGS", "1");
}
Expand Down Expand Up @@ -1256,7 +1256,7 @@ pub fn rustc_cargo(
// us a faster startup time. However GNU ld < 2.40 will error if we try to link a shared object
// with direct references to protected symbols, so for now we only use protected symbols if
// linking with LLD is enabled.
if builder.build.config.bootstrap_override_lld.is_used() {
if builder.sess.config.bootstrap_override_lld.is_used() {
cargo.rustflag("-Zdefault-visibility=protected");
}

Expand Down
16 changes: 8 additions & 8 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ impl CommandLineStep for Rustc {
let page_src = file_entry.path();
let page_dst = man_dst.join(file_entry.file_name());
let src_text = t!(std::fs::read_to_string(&page_src));
let version = builder.rust_info().version(builder.build, &builder.version);
let version = builder.rust_info().version(builder.sess, &builder.version);
let new_text = src_text.replace("<INSERT VERSION HERE>", &version);
t!(std::fs::write(&page_dst, &new_text));
}
Expand Down Expand Up @@ -774,7 +774,7 @@ impl Step for DebuggerScripts {
cp_debugger_script("gdb_load_rust_pretty_printers.py");
cp_debugger_script("gdb_lookup.py");
cp_debugger_script("gdb_providers.py");
if builder.build.unstable_features() {
if builder.sess.unstable_features() {
cp_debugger_script("gdb_trim_paths.py");
}

Expand All @@ -787,7 +787,7 @@ impl Step for DebuggerScripts {

cp_debugger_script("lldb_lookup.py");
cp_debugger_script("lldb_providers.py");
if builder.build.unstable_features() {
if builder.sess.unstable_features() {
cp_debugger_script("lldb_trim_paths.py");
}
}
Expand Down Expand Up @@ -1624,7 +1624,7 @@ impl CommandLineStep for Miri {
// This prevents miri from being built for "dist" or "install"
// on the stable/beta channels. It is a nightly-only tool and should
// not be included.
if !builder.build.unstable_features() {
if !builder.sess.unstable_features() {
return None;
}

Expand Down Expand Up @@ -1681,7 +1681,7 @@ impl CommandLineStep for CraneliftCodegenBackend {
// This prevents rustc_codegen_cranelift from being built for "dist"
// or "install" on the stable/beta channels. It is not yet stable and
// should not be included.
if !builder.build.unstable_features() {
if !builder.sess.unstable_features() {
return None;
}

Expand Down Expand Up @@ -1755,7 +1755,7 @@ impl CommandLineStep for GccCodegenBackend {
// This prevents rustc_codegen_gcc from being built for "dist"
// or "install" on the stable/beta channels. It is not yet stable and
// should not be included.
if !builder.build.unstable_features() {
if !builder.sess.unstable_features() {
return None;
}

Expand Down Expand Up @@ -2837,7 +2837,7 @@ impl CommandLineStep for Enzyme {
// This prevents Enzyme from being built for "dist"
// or "install" on the stable/beta channels. It is not yet stable and
// should not be included.
if !builder.build.unstable_features() {
if !builder.sess.unstable_features() {
return None;
}

Expand Down Expand Up @@ -3232,7 +3232,7 @@ impl CommandLineStep for Gcc {
// This prevents gcc from being built for "dist"
// or "install" on the stable/beta channels. It is not yet stable and
// should not be included.
if !builder.build.unstable_features() {
if !builder.sess.unstable_features() {
return None;
}

Expand Down
Loading
Loading