Skip to content

Commit 7d40bb9

Browse files
committed
fix 'rustc-push' and adjust help texts
1 parent de5201f commit 7d40bb9

File tree

1 file changed

+60
-32
lines changed
  • src/tools/miri/miri-script/src

1 file changed

+60
-32
lines changed

src/tools/miri/miri-script/src/main.rs

+60-32
Original file line numberDiff line numberDiff line change
@@ -29,60 +29,74 @@ fn parse_range(val: &str) -> anyhow::Result<Range<u32>> {
2929

3030
#[derive(Clone, Debug, Subcommand)]
3131
pub enum Command {
32-
/// Installs the miri driver and cargo-miri.
32+
/// Installs the miri driver and cargo-miri to the sysroot of the active toolchain.
33+
///
3334
/// Sets up the rpath such that the installed binary should work in any
34-
/// working directory. Note that the binaries are placed in the `miri` toolchain
35-
/// sysroot, to prevent conflicts with other toolchains.
35+
/// working directory.
3636
Install {
3737
/// Flags that are passed through to `cargo install`.
3838
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
3939
flags: Vec<String>,
4040
},
41-
/// Just build miri.
41+
/// Build Miri.
4242
Build {
4343
/// Flags that are passed through to `cargo build`.
4444
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
4545
flags: Vec<String>,
4646
},
47-
/// Just check miri.
47+
/// Check Miri.
4848
Check {
4949
/// Flags that are passed through to `cargo check`.
5050
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
5151
flags: Vec<String>,
5252
},
53-
/// Build miri, set up a sysroot and then run the test suite.
53+
/// Check Miri with Clippy.
54+
Clippy {
55+
/// Flags that are passed through to `cargo clippy`.
56+
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
57+
flags: Vec<String>,
58+
},
59+
/// Run the Miri test suite.
5460
Test {
61+
/// Update stdout/stderr reference files.
5562
#[arg(long)]
5663
bless: bool,
5764
/// The cross-interpretation target.
58-
/// If none then the host is the target.
5965
#[arg(long)]
6066
target: Option<String>,
61-
/// Produce coverage report if set.
67+
/// Produce coverage report.
6268
#[arg(long)]
6369
coverage: bool,
6470
/// Flags that are passed through to the test harness.
6571
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
6672
flags: Vec<String>,
6773
},
68-
/// Build miri, set up a sysroot and then run the driver with the given <flags>.
69-
/// (Also respects MIRIFLAGS environment variable.)
74+
/// Run the Miri driver.
75+
///
76+
/// Also respects MIRIFLAGS environment variable.
7077
Run {
78+
/// Build the program with the dependencies declared in `test_dependencies/Cargo.toml`.
7179
#[arg(long)]
7280
dep: bool,
81+
/// Show build progress.
7382
#[arg(long, short)]
7483
verbose: bool,
84+
/// Run the driver with the seeds in the given range (`..to` or `from..to`, default: `0..64`).
7585
#[arg(long, value_parser = parse_range)]
7686
many_seeds: Option<Range<u32>>,
87+
/// The cross-interpretation target.
7788
#[arg(long)]
7889
target: Option<String>,
90+
/// The Rust edition.
7991
#[arg(long)]
8092
edition: Option<String>,
8193
/// Flags that are passed through to `miri`.
94+
///
95+
/// The flags set in `MIRIFLAGS` are added in front of these flags.
8296
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
8397
flags: Vec<String>,
8498
},
85-
/// Build documentation
99+
/// Build documentation.
86100
Doc {
87101
/// Flags that are passed through to `cargo doc`.
88102
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
@@ -94,34 +108,45 @@ pub enum Command {
94108
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
95109
flags: Vec<String>,
96110
},
97-
/// Runs clippy on all sources.
98-
Clippy {
99-
/// Flags that are passed through to `cargo clippy`.
100-
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
101-
flags: Vec<String>,
102-
},
103-
/// Runs the benchmarks from bench-cargo-miri in hyperfine. hyperfine needs to be installed.
111+
/// Runs the benchmarks from bench-cargo-miri in hyperfine.
112+
///
113+
/// hyperfine needs to be installed.
104114
Bench {
105115
#[arg(long)]
106116
target: Option<String>,
107117
/// When `true`, skip the `./miri install` step.
118+
#[arg(long)]
108119
no_install: bool,
109-
/// List of benchmarks to run. By default all benchmarks are run.
120+
/// List of benchmarks to run (default: run all benchmarks).
110121
benches: Vec<String>,
111122
},
112-
/// Update and activate the rustup toolchain 'miri' to the commit given in the
113-
/// `rust-version` file.
114-
/// `rustup-toolchain-install-master` must be installed for this to work. Any extra
115-
/// flags are passed to `rustup-toolchain-install-master`.
116-
Toolchain { flags: Vec<String> },
117-
/// Pull and merge Miri changes from the rustc repo. Defaults to fetching the latest
118-
/// rustc commit. The fetched commit is stored in the `rust-version` file, so the
119-
/// next `./miri toolchain` will install the rustc that just got pulled.
120-
RustcPull { commit: Option<String> },
121-
/// Push Miri changes back to the rustc repo. This will pull a copy of the rustc
122-
/// history into the Miri repo, unless you set the RUSTC_GIT env var to an existing
123-
/// clone of the rustc repo.
124-
RustcPush { github_user: String, branch: String },
123+
/// Update and activate the rustup toolchain 'miri'.
124+
///
125+
/// The `rust-version` file is used to determine the commit that will be intsalled.
126+
/// `rustup-toolchain-install-master` must be installed for this to work.
127+
Toolchain {
128+
/// Flags that are passed through to `rustup-toolchain-install-master`.
129+
flags: Vec<String>,
130+
},
131+
/// Pull and merge Miri changes from the rustc repo.
132+
///
133+
/// The fetched commit is stored in the `rust-version` file, so the next `./miri toolchain` will
134+
/// install the rustc that just got pulled.
135+
RustcPull {
136+
/// The commit to fetch (default: latest rustc commit).
137+
commit: Option<String>,
138+
},
139+
/// Push Miri changes back to the rustc repo.
140+
///
141+
/// This will pull a copy of the rustc history into the Miri repo, unless you set the RUSTC_GIT
142+
/// env var to an existing clone of the rustc repo.
143+
RustcPush {
144+
/// The Github user that owns the rustc fork to which we should push.
145+
github_user: String,
146+
/// The branch to push to.
147+
#[arg(default_value = "miri-sync")]
148+
branch: String,
149+
},
125150
}
126151

127152
impl Command {
@@ -150,6 +175,9 @@ impl Command {
150175
}
151176

152177
#[derive(Parser)]
178+
#[command(after_help = "Environment variables:
179+
MIRI_SYSROOT: If already set, the \"sysroot setup\" step is skipped
180+
CARGO_EXTRA_FLAGS: Pass extra flags to all cargo invocations")]
153181
pub struct Cli {
154182
#[command(subcommand)]
155183
pub command: Command,

0 commit comments

Comments
 (0)