add './miri doc' command
This commit is contained in:
parent
d2e0970bde
commit
118be4182c
4 changed files with 21 additions and 1 deletions
2
src/tools/miri/.github/workflows/ci.yml
vendored
2
src/tools/miri/.github/workflows/ci.yml
vendored
|
|
@ -60,7 +60,7 @@ jobs:
|
|||
- name: clippy (all features)
|
||||
run: ./miri clippy --all-features -- -D warnings
|
||||
- name: rustdoc
|
||||
run: RUSTDOCFLAGS="-Dwarnings" ./miri cargo doc --document-private-items
|
||||
run: RUSTDOCFLAGS="-Dwarnings" ./miri doc --document-private-items
|
||||
|
||||
# These jobs doesn't actually test anything, but they're only used to tell
|
||||
# bors the build completed, as there is no practical way to detect when a
|
||||
|
|
|
|||
|
|
@ -153,6 +153,7 @@ impl Command {
|
|||
| Command::Test { .. }
|
||||
| Command::Run { .. }
|
||||
| Command::Fmt { .. }
|
||||
| Command::Doc { .. }
|
||||
| Command::Clippy { .. } => Self::auto_actions()?,
|
||||
| Command::Toolchain { .. }
|
||||
| Command::Bench { .. }
|
||||
|
|
@ -167,6 +168,7 @@ impl Command {
|
|||
Command::Test { bless, flags, target } => Self::test(bless, flags, target),
|
||||
Command::Run { dep, verbose, many_seeds, target, edition, flags } =>
|
||||
Self::run(dep, verbose, many_seeds, target, edition, flags),
|
||||
Command::Doc { flags } => Self::doc(flags),
|
||||
Command::Fmt { flags } => Self::fmt(flags),
|
||||
Command::Clippy { flags } => Self::clippy(flags),
|
||||
Command::Bench { target, benches } => Self::bench(target, benches),
|
||||
|
|
@ -439,6 +441,13 @@ impl Command {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn doc(flags: Vec<String>) -> Result<()> {
|
||||
let e = MiriEnv::new()?;
|
||||
e.doc(path!(e.miri_dir / "Cargo.toml"), &flags)?;
|
||||
e.doc(path!(e.miri_dir / "cargo-miri" / "Cargo.toml"), &flags)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn clippy(flags: Vec<String>) -> Result<()> {
|
||||
let e = MiriEnv::new()?;
|
||||
e.clippy(path!(e.miri_dir / "Cargo.toml"), &flags)?;
|
||||
|
|
|
|||
|
|
@ -48,6 +48,11 @@ pub enum Command {
|
|||
/// Flags that are passed through to `miri`.
|
||||
flags: Vec<String>,
|
||||
},
|
||||
/// Build documentation
|
||||
Doc {
|
||||
/// Flags that are passed through to `cargo doc`.
|
||||
flags: Vec<String>,
|
||||
},
|
||||
/// Format all sources and tests.
|
||||
Fmt {
|
||||
/// Flags that are passed through to `rustfmt`.
|
||||
|
|
@ -148,6 +153,7 @@ fn main() -> Result<()> {
|
|||
let command = match args.next_raw().as_deref() {
|
||||
Some("build") => Command::Build { flags: args.remainder() },
|
||||
Some("check") => Command::Check { flags: args.remainder() },
|
||||
Some("doc") => Command::Doc { flags: args.remainder() },
|
||||
Some("test") => {
|
||||
let mut target = None;
|
||||
let mut bless = false;
|
||||
|
|
|
|||
|
|
@ -150,6 +150,11 @@ impl MiriEnv {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn doc(&self, manifest_path: impl AsRef<OsStr>, args: &[String]) -> Result<()> {
|
||||
self.cargo_cmd(manifest_path, "doc").args(args).run()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn clippy(&self, manifest_path: impl AsRef<OsStr>, args: &[String]) -> Result<()> {
|
||||
self.cargo_cmd(manifest_path, "clippy").arg("--all-targets").args(args).run()?;
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue