Skip to content

Commit c51ed7b

Browse files
committed
Auto merge of #5587 - matklad:rustdoc-target, r=alexcrichton
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).
2 parents f9255c7 + a118cdb commit c51ed7b

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/bin/cargo/commands/rustdoc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub fn cli() -> App {
2727
)
2828
.arg_release("Build artifacts in release mode, with optimizations")
2929
.arg_features()
30+
.arg_target_triple("Build for the target triple")
3031
.arg_target_dir()
3132
.arg_manifest_path()
3233
.arg_message_format()

tests/testsuite/rustdoc.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,3 +251,32 @@ fn features() {
251251
.with_stderr_contains("[..]feature=[..]quux[..]"),
252252
);
253253
}
254+
255+
#[test]
256+
#[cfg(all(target_arch = "x86_64", target_os = "linux"))]
257+
fn rustdoc_target() {
258+
let p = project("foo")
259+
.file(
260+
"Cargo.toml",
261+
r#"
262+
[package]
263+
name = "a"
264+
version = "0.0.1"
265+
authors = []
266+
"#,
267+
)
268+
.file("src/lib.rs", "")
269+
.build();
270+
271+
assert_that(
272+
p.cargo("rustdoc --verbose --target x86_64-unknown-linux-gnu"),
273+
execs().with_status(0).with_stderr("\
274+
[DOCUMENTING] a v0.0.1 ([..])
275+
[RUNNING] `rustdoc --crate-name a src[/]lib.rs \
276+
--target x86_64-unknown-linux-gnu \
277+
-o [..]foo[/]target[/]x86_64-unknown-linux-gnu[/]doc \
278+
-L dependency=[..]foo[/]target[/]x86_64-unknown-linux-gnu[/]debug[/]deps \
279+
-L dependency=[..]foo[/]target[/]debug[/]deps`
280+
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"),
281+
);
282+
}

0 commit comments

Comments
 (0)