Skip to content

Commit

Permalink
Auto merge of #5587 - matklad:rustdoc-target, r=alexcrichton
Browse files Browse the repository at this point in the history
Support `--target` argument in `cargo rustdoc`

We don't support `--target` in `cargo rustdoc`. Seems like an omission to me? We support it in `cargo rustc`. Discovered in #5543 (comment).
  • Loading branch information
bors committed May 28, 2018
2 parents f9255c7 + a118cdb commit c51ed7b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/bin/cargo/commands/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub fn cli() -> App {
)
.arg_release("Build artifacts in release mode, with optimizations")
.arg_features()
.arg_target_triple("Build for the target triple")
.arg_target_dir()
.arg_manifest_path()
.arg_message_format()
Expand Down
29 changes: 29 additions & 0 deletions tests/testsuite/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,32 @@ fn features() {
.with_stderr_contains("[..]feature=[..]quux[..]"),
);
}

#[test]
#[cfg(all(target_arch = "x86_64", target_os = "linux"))]
fn rustdoc_target() {
let p = project("foo")
.file(
"Cargo.toml",
r#"
[package]
name = "a"
version = "0.0.1"
authors = []
"#,
)
.file("src/lib.rs", "")
.build();

assert_that(
p.cargo("rustdoc --verbose --target x86_64-unknown-linux-gnu"),
execs().with_status(0).with_stderr("\
[DOCUMENTING] a v0.0.1 ([..])
[RUNNING] `rustdoc --crate-name a src[/]lib.rs \
--target x86_64-unknown-linux-gnu \
-o [..]foo[/]target[/]x86_64-unknown-linux-gnu[/]doc \
-L dependency=[..]foo[/]target[/]x86_64-unknown-linux-gnu[/]debug[/]deps \
-L dependency=[..]foo[/]target[/]debug[/]deps`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"),
);
}

0 comments on commit c51ed7b

Please sign in to comment.