Skip to content

Commit d8e7771

Browse files
committed
add './miri doc' command
1 parent 120467c commit d8e7771

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
@@ -153,6 +153,7 @@ impl Command {
153153
| Command::Test { .. }
154154
| Command::Run { .. }
155155
| Command::Fmt { .. }
156+
| Command::Doc { .. }
156157
| Command::Clippy { .. } => Self::auto_actions()?,
157158
| Command::Toolchain { .. }
158159
| Command::Bench { .. }
@@ -167,6 +168,7 @@ impl Command {
167168
Command::Test { bless, flags, target } => Self::test(bless, flags, target),
168169
Command::Run { dep, verbose, many_seeds, target, edition, flags } =>
169170
Self::run(dep, verbose, many_seeds, target, edition, flags),
171+
Command::Doc { flags } => Self::doc(flags),
170172
Command::Fmt { flags } => Self::fmt(flags),
171173
Command::Clippy { flags } => Self::clippy(flags),
172174
Command::Bench { target, benches } => Self::bench(target, benches),
@@ -439,6 +441,13 @@ impl Command {
439441
Ok(())
440442
}
441443

444+
fn doc(flags: Vec<String>) -> Result<()> {
445+
let e = MiriEnv::new()?;
446+
e.doc(path!(e.miri_dir / "Cargo.toml"), &flags)?;
447+
e.doc(path!(e.miri_dir / "cargo-miri" / "Cargo.toml"), &flags)?;
448+
Ok(())
449+
}
450+
442451
fn clippy(flags: Vec<String>) -> Result<()> {
443452
let e = MiriEnv::new()?;
444453
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
@@ -150,6 +150,11 @@ impl MiriEnv {
150150
Ok(())
151151
}
152152

153+
pub fn doc(&self, manifest_path: impl AsRef<OsStr>, args: &[String]) -> Result<()> {
154+
self.cargo_cmd(manifest_path, "doc").args(args).run()?;
155+
Ok(())
156+
}
157+
153158
pub fn clippy(&self, manifest_path: impl AsRef<OsStr>, args: &[String]) -> Result<()> {
154159
self.cargo_cmd(manifest_path, "clippy").arg("--all-targets").args(args).run()?;
155160
Ok(())

0 commit comments

Comments
 (0)