diff --git a/tests/run-make/rustdoc-default-output/output-default.stdout b/tests/run-make/rustdoc-default-output/output-default.stdout index c1b246e849c..01f470f6e16 100644 --- a/tests/run-make/rustdoc-default-output/output-default.stdout +++ b/tests/run-make/rustdoc-default-output/output-default.stdout @@ -153,7 +153,7 @@ Options: --generate-redirect-map Generate JSON file at the top level instead of generating HTML redirection files - --emit [unversioned-shared-resources,toolchain-shared-resources,invocation-specific] + --emit [unversioned-shared-resources,toolchain-shared-resources,invocation-specific,dep-info] Comma separated list of types of output for rustdoc to emit --no-run Compile doctests without running them diff --git a/tests/run-make/rustdoc-dep-info/bar.rs b/tests/run-make/rustdoc-dep-info/bar.rs new file mode 100644 index 00000000000..76b8dcd05c8 --- /dev/null +++ b/tests/run-make/rustdoc-dep-info/bar.rs @@ -0,0 +1 @@ +include!("foo.rs"); diff --git a/tests/run-make/rustdoc-dep-info/doc.md b/tests/run-make/rustdoc-dep-info/doc.md new file mode 100644 index 00000000000..6a4238fc8b6 --- /dev/null +++ b/tests/run-make/rustdoc-dep-info/doc.md @@ -0,0 +1 @@ +blablabla diff --git a/tests/run-make/rustdoc-dep-info/foo.rs b/tests/run-make/rustdoc-dep-info/foo.rs new file mode 100644 index 00000000000..b76b4321d62 --- /dev/null +++ b/tests/run-make/rustdoc-dep-info/foo.rs @@ -0,0 +1 @@ +pub fn foo() {} diff --git a/tests/run-make/rustdoc-dep-info/lib.rs b/tests/run-make/rustdoc-dep-info/lib.rs new file mode 100644 index 00000000000..1f003f79b1f --- /dev/null +++ b/tests/run-make/rustdoc-dep-info/lib.rs @@ -0,0 +1,6 @@ +#![crate_name = "foo"] + +#[cfg_attr(doc, doc = include_str!("doc.md"))] +pub struct Bar; + +mod bar; diff --git a/tests/run-make/rustdoc-dep-info/rmake.rs b/tests/run-make/rustdoc-dep-info/rmake.rs new file mode 100644 index 00000000000..6902bfc21ca --- /dev/null +++ b/tests/run-make/rustdoc-dep-info/rmake.rs @@ -0,0 +1,21 @@ +// This is a simple smoke test for rustdoc's `--emit dep-info` feature. It prints out +// information about dependencies in a Makefile-compatible format, as a `.d` file. + +use run_make_support::assertion_helpers::assert_contains; +use run_make_support::{path, rfs, rustdoc}; + +fn main() { + // We're only emitting dep info, so we shouldn't be running static analysis to + // figure out that this program is erroneous. + rustdoc().input("lib.rs").arg("-Zunstable-options").emit("dep-info").run(); + + let content = rfs::read_to_string("foo.d"); + assert_contains(&content, "lib.rs:"); + assert_contains(&content, "foo.rs:"); + assert_contains(&content, "bar.rs:"); + assert_contains(&content, "doc.md:"); + + // Now we check that we can provide a file name to the `dep-info` argument. + rustdoc().input("lib.rs").arg("-Zunstable-options").emit("dep-info=bla.d").run(); + assert!(path("bla.d").exists()); +}