Skip to content

Commit 9e21767

Browse files
committed
add './miri doc' command
1 parent 6914420 commit 9e21767

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
- name: clippy (all features)
6161
run: ./miri clippy --all-features -- -D warnings
6262
- name: rustdoc
63-
run: RUSTDOCFLAGS="-Dwarnings" ./miri cargo doc --document-private-items
63+
run: RUSTDOCFLAGS="-Dwarnings" ./miri doc --document-private-items
6464

6565
# These jobs doesn't actually test anything, but they're only used to tell
6666
# bors the build completed, as there is no practical way to detect when a

miri-script/src/commands.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ impl Command {
168168
| Command::Test { .. }
169169
| Command::Run { .. }
170170
| Command::Fmt { .. }
171+
| Command::Doc { .. }
171172
| Command::Clippy { .. } => Self::auto_actions()?,
172173
| Command::Toolchain { .. }
173174
| Command::Bench { .. }
@@ -182,6 +183,7 @@ impl Command {
182183
Command::Test { bless, flags, target } => Self::test(bless, flags, target),
183184
Command::Run { dep, verbose, many_seeds, target, edition, flags } =>
184185
Self::run(dep, verbose, many_seeds, target, edition, flags),
186+
Command::Doc { flags } => Self::doc(flags),
185187
Command::Fmt { flags } => Self::fmt(flags),
186188
Command::Clippy { flags } => Self::clippy(flags),
187189
Command::Bench { target, benches } => Self::bench(target, benches),
@@ -454,6 +456,13 @@ impl Command {
454456
Ok(())
455457
}
456458

459+
fn doc(flags: Vec<String>) -> Result<()> {
460+
let e = MiriEnv::new()?;
461+
e.doc(path!(e.miri_dir / "Cargo.toml"), &flags)?;
462+
e.doc(path!(e.miri_dir / "cargo-miri" / "Cargo.toml"), &flags)?;
463+
Ok(())
464+
}
465+
457466
fn clippy(flags: Vec<String>) -> Result<()> {
458467
let e = MiriEnv::new()?;
459468
e.clippy(path!(e.miri_dir / "Cargo.toml"), &flags)?;

miri-script/src/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ pub enum Command {
4848
/// Flags that are passed through to `miri`.
4949
flags: Vec<String>,
5050
},
51+
/// Build documentation
52+
Doc {
53+
/// Flags that are passed through to `cargo doc`.
54+
flags: Vec<String>,
55+
},
5156
/// Format all sources and tests.
5257
Fmt {
5358
/// Flags that are passed through to `rustfmt`.
@@ -148,6 +153,7 @@ fn main() -> Result<()> {
148153
let command = match args.next_raw().as_deref() {
149154
Some("build") => Command::Build { flags: args.remainder() },
150155
Some("check") => Command::Check { flags: args.remainder() },
156+
Some("doc") => Command::Doc { flags: args.remainder() },
151157
Some("test") => {
152158
let mut target = None;
153159
let mut bless = false;

miri-script/src/util.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ impl MiriEnv {
162162
Ok(())
163163
}
164164

165+
pub fn doc(&self, manifest_path: impl AsRef<OsStr>, args: &[String]) -> Result<()> {
166+
self.cargo_cmd(manifest_path, "doc").args(args).run()?;
167+
Ok(())
168+
}
169+
165170
pub fn clippy(&self, manifest_path: impl AsRef<OsStr>, args: &[String]) -> Result<()> {
166171
self.cargo_cmd(manifest_path, "clippy").arg("--all-targets").args(args).run()?;
167172
Ok(())

0 commit comments

Comments
 (0)