Skip to content

Commit 441972d

Browse files
committed
Rename detail_exit_macro to exit
`detail` and `macro` weren't adding any info.
1 parent 33a2c24 commit 441972d

File tree

15 files changed

+39
-37
lines changed

15 files changed

+39
-37
lines changed

src/bootstrap/builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ impl StepDescription {
358358
eprintln!(
359359
"note: if you are adding a new Step to bootstrap itself, make sure you register it with `describe!`"
360360
);
361-
crate::detail_exit_macro!(1);
361+
crate::exit!(1);
362362
}
363363
}
364364
}
@@ -1338,7 +1338,7 @@ impl<'a> Builder<'a> {
13381338
"error: `x.py clippy` requires a host `rustc` toolchain with the `clippy` component"
13391339
);
13401340
eprintln!("help: try `rustup component add clippy`");
1341-
crate::detail_exit_macro!(1);
1341+
crate::exit!(1);
13421342
});
13431343
if !t!(std::str::from_utf8(&output.stdout)).contains("nightly") {
13441344
rustflags.arg("--cfg=bootstrap");

src/bootstrap/compile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1826,7 +1826,7 @@ pub fn run_cargo(
18261826
});
18271827

18281828
if !ok {
1829-
crate::detail_exit_macro!(1);
1829+
crate::exit!(1);
18301830
}
18311831

18321832
// Ok now we need to actually find all the files listed in `toplevel`. We've

src/bootstrap/config.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate::channel::{self, GitInfo};
2323
pub use crate::flags::Subcommand;
2424
use crate::flags::{Color, Flags, Warnings};
2525
use crate::util::{exe, output, t};
26-
use build_helper::detail_exit_macro;
26+
use build_helper::exit;
2727
use once_cell::sync::OnceCell;
2828
use semver::Version;
2929
use serde::{Deserialize, Deserializer};
@@ -646,7 +646,7 @@ macro_rules! define_config {
646646
panic!("overriding existing option")
647647
} else {
648648
eprintln!("overriding existing option: `{}`", stringify!($field));
649-
detail_exit_macro!(2);
649+
exit!(2);
650650
}
651651
} else {
652652
self.$field = other.$field;
@@ -745,7 +745,7 @@ impl<T> Merge for Option<T> {
745745
panic!("overriding existing option")
746746
} else {
747747
eprintln!("overriding existing option");
748-
detail_exit_macro!(2);
748+
exit!(2);
749749
}
750750
} else {
751751
*self = other;
@@ -1101,7 +1101,7 @@ impl Config {
11011101
.and_then(|table: toml::Value| TomlConfig::deserialize(table))
11021102
.unwrap_or_else(|err| {
11031103
eprintln!("failed to parse TOML configuration '{}': {err}", file.display());
1104-
detail_exit_macro!(2);
1104+
exit!(2);
11051105
})
11061106
}
11071107
Self::parse_inner(args, get_toml)
@@ -1135,7 +1135,7 @@ impl Config {
11351135
eprintln!(
11361136
"Cannot use both `llvm_bolt_profile_generate` and `llvm_bolt_profile_use` at the same time"
11371137
);
1138-
detail_exit_macro!(1);
1138+
exit!(1);
11391139
}
11401140

11411141
// Infer the rest of the configuration.
@@ -1259,7 +1259,7 @@ impl Config {
12591259
}
12601260
}
12611261
eprintln!("failed to parse override `{option}`: `{err}");
1262-
detail_exit_macro!(2)
1262+
exit!(2)
12631263
}
12641264
toml.merge(override_toml, ReplaceOpt::Override);
12651265

@@ -2007,7 +2007,7 @@ impl Config {
20072007
"Unexpected rustc version: {}, we should use {}/{} to build source with {}",
20082008
rustc_version, prev_version, source_version, source_version
20092009
);
2010-
detail_exit_macro!(1);
2010+
exit!(1);
20112011
}
20122012
}
20132013

@@ -2043,7 +2043,7 @@ impl Config {
20432043
println!("help: maybe your repository history is too shallow?");
20442044
println!("help: consider disabling `download-rustc`");
20452045
println!("help: or fetch enough history to include one upstream commit");
2046-
crate::detail_exit_macro!(1);
2046+
crate::exit!(1);
20472047
}
20482048

20492049
// Warn if there were changes to the compiler or standard library since the ancestor commit.

src/bootstrap/download.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ impl Config {
248248
if !help_on_error.is_empty() {
249249
eprintln!("{}", help_on_error);
250250
}
251-
crate::detail_exit_macro!(1);
251+
crate::exit!(1);
252252
}
253253
}
254254

src/bootstrap/flags.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ impl Flags {
193193
} else {
194194
panic!("No paths available for subcommand `{}`", subcommand.as_str());
195195
}
196-
crate::detail_exit_macro!(0);
196+
crate::exit!(0);
197197
}
198198

199199
Flags::parse_from(it)
@@ -538,7 +538,7 @@ pub fn get_completion<G: clap_complete::Generator>(shell: G, path: &Path) -> Opt
538538
} else {
539539
std::fs::read_to_string(path).unwrap_or_else(|_| {
540540
eprintln!("couldn't read {}", path.display());
541-
crate::detail_exit_macro!(1)
541+
crate::exit!(1)
542542
})
543543
};
544544
let mut buf = Vec::new();

src/bootstrap/format.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn rustfmt(src: &Path, rustfmt: &Path, paths: &[PathBuf], check: bool) -> impl F
4040
code, run `./x.py fmt` instead.",
4141
cmd_debug,
4242
);
43-
crate::detail_exit_macro!(1);
43+
crate::exit!(1);
4444
}
4545
true
4646
}
@@ -196,7 +196,7 @@ pub fn format(build: &Builder<'_>, check: bool, paths: &[PathBuf]) {
196196

197197
let rustfmt_path = build.initial_rustfmt().unwrap_or_else(|| {
198198
eprintln!("./x.py fmt is not supported on this channel");
199-
crate::detail_exit_macro!(1);
199+
crate::exit!(1);
200200
});
201201
assert!(rustfmt_path.exists(), "{}", rustfmt_path.display());
202202
let src = build.src.clone();

src/bootstrap/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use std::process::{Command, Stdio};
2727
use std::str;
2828

2929
use build_helper::ci::{gha, CiEnv};
30-
use build_helper::detail_exit_macro;
30+
use build_helper::exit;
3131
use channel::GitInfo;
3232
use config::{DryRun, Target};
3333
use filetime::FileTime;
@@ -711,7 +711,7 @@ impl Build {
711711
for failure in failures.iter() {
712712
eprintln!(" - {}\n", failure);
713713
}
714-
detail_exit_macro!(1);
714+
exit!(1);
715715
}
716716

717717
#[cfg(feature = "build-metrics")]
@@ -1515,7 +1515,7 @@ impl Build {
15151515
"Error: Unable to find the stamp file {}, did you try to keep a nonexistent build stage?",
15161516
stamp.display()
15171517
);
1518-
crate::detail_exit_macro!(1);
1518+
crate::exit!(1);
15191519
}
15201520

15211521
let mut paths = Vec::new();
@@ -1707,7 +1707,7 @@ Alternatively, set `download-ci-llvm = true` in that `[llvm]` section
17071707
to download LLVM rather than building it.
17081708
"
17091709
);
1710-
detail_exit_macro!(1);
1710+
exit!(1);
17111711
}
17121712
}
17131713

src/bootstrap/render_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub(crate) fn try_run_tests(builder: &Builder<'_>, cmd: &mut Command, stream: bo
3030

3131
if !run_tests(builder, cmd, stream) {
3232
if builder.fail_fast {
33-
crate::detail_exit_macro!(1);
33+
crate::exit!(1);
3434
} else {
3535
let mut failures = builder.delayed_failures.borrow_mut();
3636
failures.push(format!("{cmd:?}"));

src/bootstrap/sanity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ You should install cmake, or set `download-ci-llvm = true` in the
104104
than building it.
105105
"
106106
);
107-
crate::detail_exit_macro!(1);
107+
crate::exit!(1);
108108
}
109109
}
110110

src/bootstrap/setup.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ fn setup_config_toml(path: &PathBuf, profile: Profile, config: &Config) {
203203
"note: this will use the configuration in {}",
204204
profile.include_path(&config.src).display()
205205
);
206-
crate::detail_exit_macro!(1);
206+
crate::exit!(1);
207207
}
208208

209209
let settings = format!(
@@ -389,7 +389,7 @@ pub fn interactive_path() -> io::Result<Profile> {
389389
io::stdin().read_line(&mut input)?;
390390
if input.is_empty() {
391391
eprintln!("EOF on stdin, when expecting answer to question. Giving up.");
392-
crate::detail_exit_macro!(1);
392+
crate::exit!(1);
393393
}
394394
break match parse_with_abbrev(&input) {
395395
Ok(profile) => profile,

src/bootstrap/test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ impl Step for Clippy {
798798
}
799799

800800
if !builder.config.cmd.bless() {
801-
crate::detail_exit_macro!(1);
801+
crate::exit!(1);
802802
}
803803
}
804804
}
@@ -1097,7 +1097,7 @@ help: to skip test's attempt to check tidiness, pass `--exclude src/tools/tidy`
10971097
PATH = inferred_rustfmt_dir.display(),
10981098
CHAN = builder.config.channel,
10991099
);
1100-
crate::detail_exit_macro!(1);
1100+
crate::exit!(1);
11011101
}
11021102
crate::format::format(&builder, !builder.config.cmd.bless(), &[]);
11031103
}
@@ -1120,7 +1120,7 @@ help: to skip test's attempt to check tidiness, pass `--exclude src/tools/tidy`
11201120
eprintln!(
11211121
"x.py completions were changed; run `x.py run generate-completions` to update them"
11221122
);
1123-
crate::detail_exit_macro!(1);
1123+
crate::exit!(1);
11241124
}
11251125
}
11261126
}
@@ -1431,7 +1431,7 @@ help: to test the compiler, use `--stage 1` instead
14311431
help: to test the standard library, use `--stage 0 library/std` instead
14321432
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 `COMPILETEST_FORCE_STAGE0=1`."
14331433
);
1434-
crate::detail_exit_macro!(1);
1434+
crate::exit!(1);
14351435
}
14361436

14371437
let mut compiler = self.compiler;

src/bootstrap/tool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl Step for ToolBuild {
116116

117117
if !is_expected {
118118
if !is_optional_tool {
119-
crate::detail_exit_macro!(1);
119+
crate::exit!(1);
120120
} else {
121121
None
122122
}

src/bootstrap/toolstate.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fn print_error(tool: &str, submodule: &str) {
9191
eprintln!("If you do NOT intend to update '{}', please ensure you did not accidentally", tool);
9292
eprintln!("change the submodule at '{}'. You may ask your reviewer for the", submodule);
9393
eprintln!("proper steps.");
94-
crate::detail_exit_macro!(3);
94+
crate::exit!(3);
9595
}
9696

9797
fn check_changed_files(toolstates: &HashMap<Box<str>, ToolState>) {
@@ -106,7 +106,7 @@ fn check_changed_files(toolstates: &HashMap<Box<str>, ToolState>) {
106106
Ok(o) => o,
107107
Err(e) => {
108108
eprintln!("Failed to get changed files: {:?}", e);
109-
crate::detail_exit_macro!(1);
109+
crate::exit!(1);
110110
}
111111
};
112112

@@ -177,7 +177,7 @@ impl Step for ToolStateCheck {
177177
}
178178

179179
if did_error {
180-
crate::detail_exit_macro!(1);
180+
crate::exit!(1);
181181
}
182182

183183
check_changed_files(&toolstates);
@@ -223,7 +223,7 @@ impl Step for ToolStateCheck {
223223
}
224224

225225
if did_error {
226-
crate::detail_exit_macro!(1);
226+
crate::exit!(1);
227227
}
228228

229229
if builder.config.channel == "nightly" && env::var_os("TOOLSTATE_PUBLISH").is_some() {

src/bootstrap/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ pub fn is_valid_test_suite_arg<'a, P: AsRef<Path>>(
229229

230230
pub fn run(cmd: &mut Command, print_cmd_on_fail: bool) {
231231
if try_run(cmd, print_cmd_on_fail).is_err() {
232-
crate::detail_exit_macro!(1);
232+
crate::exit!(1);
233233
}
234234
}
235235

@@ -253,7 +253,7 @@ pub fn check_run(cmd: &mut Command, print_cmd_on_fail: bool) -> bool {
253253

254254
pub fn run_suppressed(cmd: &mut Command) {
255255
if !try_run_suppressed(cmd) {
256-
crate::detail_exit_macro!(1);
256+
crate::exit!(1);
257257
}
258258
}
259259

src/tools/build_helper/src/util.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
use std::process::Command;
22

33
/// Invokes `build_helper::util::detail_exit` with `cfg!(test)`
4+
///
5+
/// This is a macro instead of a function so that it uses `cfg(test)` in the *calling* crate, not in build helper.
46
#[macro_export]
5-
macro_rules! detail_exit_macro {
7+
macro_rules! exit {
68
($code:expr) => {
7-
build_helper::util::detail_exit($code, cfg!(test));
9+
$crate::util::detail_exit($code, cfg!(test));
810
};
911
}
1012

0 commit comments

Comments
 (0)