]> git.lizzy.rs Git - rust.git/commitdiff
Fix `x test src/librustdoc --no-doc`
authorJoshua Nelson <jnelson@cloudflare.com>
Sun, 27 Mar 2022 14:13:04 +0000 (09:13 -0500)
committerJoshua Nelson <jnelson@cloudflare.com>
Sun, 27 Mar 2022 14:21:50 +0000 (09:21 -0500)
Previously, it would erroneously try to run the doc-tests anyway and give an error:
```
   Doc-tests rustdoc
thread 'main' panicked at 'RUSTDOC_LIBDIR was not set', src/bootstrap/bin/rustdoc.rs:15:48
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: test failed, to rerun pass '--doc'
```

src/bootstrap/test.rs

index 8ed1ad3678ea398350bf4c14f16b5f8a6f2ae96e..a8c511ea6933038796dbd57d8ace730f848736cb 100644 (file)
@@ -2118,6 +2118,15 @@ fn run(self, builder: &Builder<'_>) {
         if test_kind.subcommand() == "test" && !builder.fail_fast {
             cargo.arg("--no-fail-fast");
         }
+        match builder.doc_tests {
+            DocTests::Only => {
+                cargo.arg("--doc");
+            }
+            DocTests::No => {
+                cargo.args(&["--lib", "--bins", "--examples", "--tests", "--benches"]);
+            }
+            DocTests::Yes => {}
+        }
 
         cargo.arg("-p").arg("rustdoc:0.0.0");