@@ -29,60 +29,74 @@ fn parse_range(val: &str) -> anyhow::Result<Range<u32>> {
29
29
30
30
#[ derive( Clone , Debug , Subcommand ) ]
31
31
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
+ ///
33
34
/// 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.
36
36
Install {
37
37
/// Flags that are passed through to `cargo install`.
38
38
#[ arg( trailing_var_arg = true , allow_hyphen_values = true ) ]
39
39
flags : Vec < String > ,
40
40
} ,
41
- /// Just build miri .
41
+ /// Build Miri .
42
42
Build {
43
43
/// Flags that are passed through to `cargo build`.
44
44
#[ arg( trailing_var_arg = true , allow_hyphen_values = true ) ]
45
45
flags : Vec < String > ,
46
46
} ,
47
- /// Just check miri .
47
+ /// Check Miri .
48
48
Check {
49
49
/// Flags that are passed through to `cargo check`.
50
50
#[ arg( trailing_var_arg = true , allow_hyphen_values = true ) ]
51
51
flags : Vec < String > ,
52
52
} ,
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.
54
60
Test {
61
+ /// Update stdout/stderr reference files.
55
62
#[ arg( long) ]
56
63
bless : bool ,
57
64
/// The cross-interpretation target.
58
- /// If none then the host is the target.
59
65
#[ arg( long) ]
60
66
target : Option < String > ,
61
- /// Produce coverage report if set .
67
+ /// Produce coverage report.
62
68
#[ arg( long) ]
63
69
coverage : bool ,
64
70
/// Flags that are passed through to the test harness.
65
71
#[ arg( trailing_var_arg = true , allow_hyphen_values = true ) ]
66
72
flags : Vec < String > ,
67
73
} ,
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.
70
77
Run {
78
+ /// Build the program with the dependencies declared in `test_dependencies/Cargo.toml`.
71
79
#[ arg( long) ]
72
80
dep : bool ,
81
+ /// Show build progress.
73
82
#[ arg( long, short) ]
74
83
verbose : bool ,
84
+ /// Run the driver with the seeds in the given range (`..to` or `from..to`, default: `0..64`).
75
85
#[ arg( long, value_parser = parse_range) ]
76
86
many_seeds : Option < Range < u32 > > ,
87
+ /// The cross-interpretation target.
77
88
#[ arg( long) ]
78
89
target : Option < String > ,
90
+ /// The Rust edition.
79
91
#[ arg( long) ]
80
92
edition : Option < String > ,
81
93
/// Flags that are passed through to `miri`.
94
+ ///
95
+ /// The flags set in `MIRIFLAGS` are added in front of these flags.
82
96
#[ arg( trailing_var_arg = true , allow_hyphen_values = true ) ]
83
97
flags : Vec < String > ,
84
98
} ,
85
- /// Build documentation
99
+ /// Build documentation.
86
100
Doc {
87
101
/// Flags that are passed through to `cargo doc`.
88
102
#[ arg( trailing_var_arg = true , allow_hyphen_values = true ) ]
@@ -94,34 +108,45 @@ pub enum Command {
94
108
#[ arg( trailing_var_arg = true , allow_hyphen_values = true ) ]
95
109
flags : Vec < String > ,
96
110
} ,
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.
104
114
Bench {
105
115
#[ arg( long) ]
106
116
target : Option < String > ,
107
117
/// When `true`, skip the `./miri install` step.
118
+ #[ arg( long) ]
108
119
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) .
110
121
benches : Vec < String > ,
111
122
} ,
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
+ } ,
125
150
}
126
151
127
152
impl Command {
@@ -150,6 +175,9 @@ impl Command {
150
175
}
151
176
152
177
#[ 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" ) ]
153
181
pub struct Cli {
154
182
#[ command( subcommand) ]
155
183
pub command : Command ,
0 commit comments