Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 1cf951e

Browse files
committed
Don’t print Preparing a sysroot when -q/--quiet is passed
1 parent 1c7e827 commit 1cf951e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/tools/miri/cargo-miri/src/phases.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
8787
),
8888
};
8989
let verbose = num_arg_flag("-v");
90+
let quiet = has_arg_flag("-q") || has_arg_flag("--quiet");
9091

9192
// Determine the involved architectures.
9293
let rustc_version = VersionMeta::for_command(miri_for_host()).unwrap_or_else(|err| {
@@ -110,7 +111,7 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
110111
}
111112

112113
// We always setup.
113-
let miri_sysroot = setup(&subcommand, target, &rustc_version, verbose);
114+
let miri_sysroot = setup(&subcommand, target, &rustc_version, verbose, quiet);
114115

115116
// Invoke actual cargo for the job, but with different flags.
116117
// We re-use `cargo test` and `cargo run`, which makes target and binary handling very easy but

src/tools/miri/cargo-miri/src/setup.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub fn setup(
1919
target: &str,
2020
rustc_version: &VersionMeta,
2121
verbose: usize,
22+
quiet: bool,
2223
) -> PathBuf {
2324
let only_setup = matches!(subcommand, MiriCommand::Setup);
2425
let ask_user = !only_setup;
@@ -119,6 +120,9 @@ pub fn setup(
119120
for _ in 0..verbose {
120121
command.arg("-v");
121122
}
123+
if quiet {
124+
command.arg("--quiet");
125+
}
122126
} else {
123127
// Suppress output.
124128
command.stdout(process::Stdio::null());
@@ -134,7 +138,7 @@ pub fn setup(
134138
let rustflags = &["-Cdebug-assertions=off", "-Coverflow-checks=on"];
135139

136140
// Do the build.
137-
if print_sysroot {
141+
if print_sysroot || quiet {
138142
// Be silent.
139143
} else {
140144
let mut msg = String::new();
@@ -169,7 +173,7 @@ pub fn setup(
169173
)
170174
}
171175
});
172-
if print_sysroot {
176+
if print_sysroot || quiet {
173177
// Be silent.
174178
} else if only_setup {
175179
eprintln!("A sysroot for Miri is now available in `{}`.", sysroot_dir.display());

0 commit comments

Comments
 (0)