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
5 changes: 3 additions & 2 deletions src/bootstrap/src/core/build_steps/clippy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ use crate::core::builder::{
};
use crate::core::config::{Subcommand, TargetSelection};
use crate::utils::build_stamp::{self, BuildStamp};
use crate::{Compiler, Mode, exit};
use crate::utils::helpers;
use crate::{Compiler, Mode};

/// Disable the most spammy clippy lints
const IGNORED_RULES_FOR_STD_AND_RUSTC: &[&str] = &[
Expand Down Expand Up @@ -543,7 +544,7 @@ impl CommandLineStep for CI {
fn run(self, builder: &Builder<'_>) -> Self::Output {
if builder.top_stage != 2 {
eprintln!("ERROR: `x clippy ci` should always be executed with --stage 2");
exit!(1);
helpers::exit_process(1);
}

// We want to check in-tree source using in-tree clippy. However, if we naively did
Expand Down
10 changes: 5 additions & 5 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ use crate::utils::build_stamp;
use crate::utils::build_stamp::BuildStamp;
use crate::utils::exec::command;
use crate::utils::helpers::{
exe, get_clang_cl_resource_dir, is_debug_info, is_dylib, symlink_dir, t, up_to_date,
self, exe, get_clang_cl_resource_dir, is_debug_info, is_dylib, symlink_dir, t, up_to_date,
};
use crate::{
CLang, CodegenBackendKind, Compiler, DependencyType, FileType, GitRepo, LLVM_TOOLS, Mode,
debug, exit, trace,
debug, trace,
};

/// Build a standard library for the given `target` using the given `build_compiler`.
Expand Down Expand Up @@ -2044,7 +2044,7 @@ impl Step for Sysroot {
sysroot_lib_rustlib_src_rust.display(),
);
}
exit!(1);
helpers::exit_process(1);
}
}

Expand All @@ -2062,7 +2062,7 @@ impl Step for Sysroot {
builder.src.display(),
e,
);
exit!(1);
helpers::exit_process(1);
}
}

Expand Down Expand Up @@ -2741,7 +2741,7 @@ pub fn run_cargo(
});

if !ok {
crate::exit!(1);
helpers::exit_process(1);
}

if builder.config.dry_run() {
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/src/core/build_steps/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ pub fn format(
if build.kind == Kind::Format && build.top_stage != 0 {
eprintln!("ERROR: `x fmt` only supports stage 0.");
eprintln!("HELP: Use `x run rustfmt` to run in-tree rustfmt.");
crate::exit!(1);
helpers::exit_process(1);
}

if !paths.is_empty() {
eprintln!(
"fmt error: path arguments are no longer accepted; use `--all` to format everything"
);
crate::exit!(1);
helpers::exit_process(1);
};
if build.config.dry_run() {
return;
Expand Down Expand Up @@ -193,7 +193,7 @@ pub fn format(
// explicit whitelisted entries and traversal of unmentioned files, but for now just
// forbid such entries.
eprintln!("fmt error: `!`-prefixed entries are not supported in rustfmt.toml, sorry");
crate::exit!(1);
helpers::exit_process(1);
} else {
override_builder.add(&format!("!{ignore}")).expect(&ignore);
}
Expand Down Expand Up @@ -362,7 +362,7 @@ pub fn format(
let result = thread.join().unwrap();

if result.is_err() {
crate::exit!(1);
helpers::exit_process(1);
}

// Update `build/.rustfmt-stamp`, allowing this code to ignore files which have not been changed
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/src/core/build_steps/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::utils::exec::command;
use crate::utils::helpers::{
self, exe, get_clang_cl_resource_dir, libdir, t, unhashed_basename, up_to_date,
};
use crate::{CLang, GitRepo, exit, trace};
use crate::{CLang, GitRepo, trace};

/// Result of building or downloading LLVM artifacts.
#[derive(Clone)]
Expand Down Expand Up @@ -1034,7 +1034,7 @@ impl CommandLineStep for RustOffload {
"`{lib_rust_offload}` not found in `{}`. Either the build has failed or RustOffload was built with a wrong version of LLVM",
build_dir.display()
);
exit!(1);
helpers::exit_process(1);
}

BuiltRustOffload { offload: dylib }
Expand Down Expand Up @@ -1266,7 +1266,7 @@ impl CommandLineStep for OmpOffload {
"`{p:?}` not found in `{}`. Either the build has failed or Offload was built with a wrong version of LLVM",
out_dir.display()
);
exit!(1);
helpers::exit_process(1);
}
}
BuiltOmpOffload { offload: files }
Expand Down Expand Up @@ -1414,7 +1414,7 @@ impl CommandLineStep for Enzyme {
"`{libenzyme}` not found in `{}`. Either the build has failed or Enzyme was built with a wrong version of LLVM",
build_dir.display()
);
exit!(1);
helpers::exit_process(1);
}

t!(stamp.write());
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/src/core/build_steps/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::path::PathBuf;
use build_helper::git::get_git_untracked_files;
use clap_complete::{Generator, shells};

use crate::Mode;
use crate::core::build_steps::dist::distdir;
use crate::core::build_steps::test;
use crate::core::build_steps::tool::{self, RustcPrivateCompilers, SourceType, Tool};
Expand All @@ -16,8 +17,7 @@ use crate::core::builder::{Builder, CommandLineStep, Kind, RunConfig, ShouldRun,
use crate::core::config::TargetSelection;
use crate::core::config::flags::{get_completion, top_level_help};
use crate::utils::exec::command;
use crate::utils::helpers::t;
use crate::{Mode, exit};
use crate::utils::helpers::{self, t};

#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct BuildManifest;
Expand Down Expand Up @@ -138,7 +138,7 @@ impl CommandLineStep for Miri {

if stage == 0 {
eprintln!("ERROR: miri cannot be run at stage 0");
exit!(1);
helpers::exit_process(1);
}

// Miri always runs on the host, because it can interpret code for any target
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/src/core/build_steps/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl CommandLineStep for Profile {
}
_ => {
println!("Exiting.");
crate::exit!(1);
helpers::exit_process(1);
}
}
}
Expand Down Expand Up @@ -415,7 +415,7 @@ pub fn interactive_path() -> io::Result<Profile> {
io::stdin().read_line(&mut input)?;
if input.is_empty() {
eprintln!("EOF on stdin, when expecting answer to question. Giving up.");
crate::exit!(1);
helpers::exit_process(1);
}
break match parse_with_abbrev(&input) {
Ok(profile) => profile,
Expand Down
24 changes: 12 additions & 12 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use crate::utils::helpers::{
up_to_date,
};
use crate::utils::render_tests::{add_flags_and_try_run_tests, try_run_tests};
use crate::{CLang, CodegenBackendKind, GitRepo, Mode, TestTarget, envify, exit};
use crate::{CLang, CodegenBackendKind, GitRepo, Mode, TestTarget, envify};

mod compiletest;
pub mod failed_tests;
Expand Down Expand Up @@ -291,7 +291,7 @@ impl CommandLineStep for Cargotest {
eprintln!(
"ERROR: running cargotest with stage 0 is currently unsupported. Use at least stage 1."
);
exit!(1);
helpers::exit_process(1);
}
// We want to build cargo stage N (where N == top_stage), and rustc stage N,
// and test both of these together.
Expand Down Expand Up @@ -948,7 +948,7 @@ impl CommandLineStep for CompiletestTest {
ERROR: `--stage 0` causes compiletest to query information from the stage0 (precompiled) compiler, instead of the in-tree compiler, which can cause some tests to fail inappropriately
NOTE: if you're sure you want to do this, please open an issue as to why. In the meantime, you can override this with `--set build.compiletest-allow-stage0=true`."
);
crate::exit!(1);
helpers::exit_process(1);
}

let bootstrap_compiler = builder.compiler(0, host);
Expand Down Expand Up @@ -1297,7 +1297,7 @@ impl CommandLineStep for Clippy {
}

if !builder.config.cmd.bless() {
crate::exit!(1);
helpers::exit_process(1);
}
}

Expand Down Expand Up @@ -1702,7 +1702,7 @@ HELP: to skip test's attempt to check tidiness, pass `--skip src/tools/tidy` to
PATH = inferred_rustfmt_dir.display(),
CHAN = builder.config.channel,
);
crate::exit!(1);
helpers::exit_process(1);
};
let all = false;
crate::core::build_steps::format::format(
Expand Down Expand Up @@ -1733,7 +1733,7 @@ HELP: to skip test's attempt to check tidiness, pass `--skip src/tools/tidy` to
eprintln!(
"x.py completions were changed; run `x.py run generate-completions` to update them"
);
crate::exit!(1);
helpers::exit_process(1);
}

builder.info("x.py help check");
Expand All @@ -1743,13 +1743,13 @@ HELP: to skip test's attempt to check tidiness, pass `--skip src/tools/tidy` to
let help_path = get_help_path(builder);
let cur_help = std::fs::read_to_string(&help_path).unwrap_or_else(|err| {
eprintln!("couldn't read {}: {}", help_path.display(), err);
crate::exit!(1);
helpers::exit_process(1);
});
let new_help = top_level_help();

if new_help != cur_help {
eprintln!("x.py help was changed; run `x.py run generate-help` to update it");
crate::exit!(1);
helpers::exit_process(1);
}
}
}
Expand Down Expand Up @@ -2232,7 +2232,7 @@ ERROR: `--stage 0` runs compiletest on the stage0 (precompiled) compiler, not yo
HELP: to test the compiler or standard library, omit the stage or explicitly use `--stage 1` instead
NOTE: if you're sure you want to do this, please open an issue as to why. In the meantime, you can override this with `--set build.compiletest-allow-stage0=true`."
);
crate::exit!(1);
helpers::exit_process(1);
}

let mut test_compiler = self.test_compiler;
Expand Down Expand Up @@ -2443,7 +2443,7 @@ ERROR: No configured backend named `{name}`
HELP: You can add it into `bootstrap.toml` in `rust.codegen-backends = [{name:?}]`",
name = codegen_backend.name(),
);
crate::exit!(1);
helpers::exit_process(1);
}

if let CodegenBackendKind::Gcc = codegen_backend
Expand Down Expand Up @@ -4806,14 +4806,14 @@ impl CommandLineStep for StdSemverCheck {
);
if builder.fail_fast {
eprintln!("{error}",);
exit!(1);
helpers::exit_process(1);
} else {
builder.config.exec_ctx().add_to_delay_failure(error);
}
}
_ => {
eprintln!("cargo-semver-checks failed.\n{}\n{}", res.stderr(), res.stdout());
exit!(1);
helpers::exit_process(1);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::core::builder::{
};
use crate::core::config::{Allocator, DebuginfoLevel, RustcLto, TargetSelection};
use crate::utils::exec::{BootstrapCommand, command};
use crate::utils::helpers::{add_dylib_path, exe, t};
use crate::utils::helpers::{self, add_dylib_path, exe, t};
use crate::{Compiler, FileType, Mode};

#[derive(Debug, Clone, Hash, PartialEq, Eq)]
Expand Down Expand Up @@ -160,7 +160,7 @@ impl Step for ToolBuild {
);

if !build_success {
crate::exit!(1);
helpers::exit_process(1);
} else {
// HACK(#82501): on Windows, the tools directory gets added to PATH when running tests, and
// compiletest confuses HTML tidy with the in-tree tidy. Name the in-tree tidy something
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/src/core/build_steps/toolstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fn print_error(tool: &str, submodule: &str) {
eprintln!("If you do NOT intend to update '{tool}', please ensure you did not accidentally");
eprintln!("change the submodule at '{submodule}'. You may ask your reviewer for the");
eprintln!("proper steps.");
crate::exit!(3);
helpers::exit_process(3);
}

fn check_changed_files(builder: &Builder<'_>, toolstates: &HashMap<Box<str>, ToolState>) {
Expand Down Expand Up @@ -170,7 +170,7 @@ impl CommandLineStep for ToolStateCheck {
}

if did_error {
crate::exit!(1);
helpers::exit_process(1);
}

check_changed_files(builder, &toolstates);
Expand Down Expand Up @@ -214,7 +214,7 @@ impl CommandLineStep for ToolStateCheck {
}

if did_error {
crate::exit!(1);
helpers::exit_process(1);
}

if builder.config.channel == "nightly" && env::var_os("TOOLSTATE_PUBLISH").is_some() {
Expand Down
7 changes: 4 additions & 3 deletions src/bootstrap/src/core/builder/cli_paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::fmt::{self, Debug};
use std::path::PathBuf;

use crate::core::builder::{Builder, CommandLineStepDescription, Kind, PathSet, ShouldRun};
use crate::utils::helpers;

#[cfg(test)]
mod tests;
Expand Down Expand Up @@ -59,7 +60,7 @@ pub(crate) fn match_paths_to_steps_and_run(
"ERROR: '{}' subcommand is incompatible with `rust.download-rustc`.",
builder.kind.as_str()
);
crate::exit!(1);
helpers::exit_process(1);
}

// sanity checks on rules
Expand Down Expand Up @@ -120,7 +121,7 @@ pub(crate) fn match_paths_to_steps_and_run(
eprintln!(
"ERROR: the following paths do not exist on disk or point outside the source directory: {bad_abs_paths:#?}"
);
crate::exit!(1);
helpers::exit_process(1);
}

// Handle all test suite paths.
Expand Down Expand Up @@ -190,6 +191,6 @@ pub(crate) fn match_paths_to_steps_and_run(
eprintln!(
"NOTE: if you are adding a new Step to bootstrap itself, make sure you register it with `describe!`"
);
crate::exit!(1);
helpers::exit_process(1);
}
}
Loading
Loading