Skip to content

Commit 19de1a7

Browse files
committed
add './miri doc' command
1 parent bda7515 commit 19de1a7

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

.github/workflows/ci.yml

+1-1
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

+9
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ impl Command {
155155
| Command::Test { .. }
156156
| Command::Run { .. }
157157
| Command::Fmt { .. }
158+
| Command::Doc { .. }
158159
| Command::Clippy { .. } => Self::auto_actions()?,
159160
| Command::Toolchain { .. }
160161
| Command::Bench { .. }
@@ -169,6 +170,7 @@ impl Command {
169170
Command::Test { bless, flags, target } => Self::test(bless, flags, target),
170171
Command::Run { dep, verbose, many_seeds, target, edition, flags } =>
171172
Self::run(dep, verbose, many_seeds, target, edition, flags),
173+
Command::Doc { flags } => Self::doc(flags),
172174
Command::Fmt { flags } => Self::fmt(flags),
173175
Command::Clippy { flags } => Self::clippy(flags),
174176
Command::Bench { target, benches } => Self::bench(target, benches),
@@ -441,6 +443,13 @@ impl Command {
441443
Ok(())
442444
}
443445

446+
fn doc(flags: Vec<String>) -> Result<()> {
447+
let e = MiriEnv::new()?;
448+
e.doc(path!(e.miri_dir / "Cargo.toml"), &flags)?;
449+
e.doc(path!(e.miri_dir / "cargo-miri" / "Cargo.toml"), &flags)?;
450+
Ok(())
451+
}
452+
444453
fn clippy(flags: Vec<String>) -> Result<()> {
445454
let e = MiriEnv::new()?;
446455
e.clippy(path!(e.miri_dir / "Cargo.toml"), &flags)?;

miri-script/src/main.rs

+6
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

+5
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ impl MiriEnv {
152152
Ok(())
153153
}
154154

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

0 commit comments

Comments
 (0)