summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-07-13 08:54:33 +0900
committerGitHub <noreply@github.com>2021-07-13 08:54:33 +0900
commitfab45bf4859d8c74fff421eafed0159fa3f47fde (patch)
tree114cec8299be214bb43adaad518998fc7092cae3 /src/bootstrap
parent2d9a0387c10a527731209338ab83817ece26ee05 (diff)
parentbd819493d7780b9b511896b5f1080d8dc419f314 (diff)
downloadrust-fab45bf4859d8c74fff421eafed0159fa3f47fde.tar.gz
rust-fab45bf4859d8c74fff421eafed0159fa3f47fde.zip
Rollup merge of #87035 - GuillaumeGomez:fix-implementors-display, r=notriddle
Fix implementors display

Part of https://github.com/rust-lang/rust/issues/86632.

This PR does a few things:
 * It fixes of the JS rendered implementors.
 * It generates anchors for JS rendered implementors to make it coherent with the others.
 * It adds a test to ensure that we won't have the same issue again.
 * It changes the way we render the rustdoc-gui crates to simplify it a bit and also to allow to have dependencies without going through compiletest.

Before:

![Screenshot from 2021-07-10 13-30-13](https://user-images.githubusercontent.com/3050060/125174172-b4048700-e1c3-11eb-8f0e-c46081371d4f.png)

After:

![Screenshot from 2021-07-10 21-11-15](https://user-images.githubusercontent.com/3050060/125174173-b49d1d80-e1c3-11eb-8740-1dbbff70c2eb.png)

I plan to add the `[src]` links in another PR because this one is already big enough.

cc `@Mark-Simulacrum` (for the bootstrap changes)

r? `@Nemo157`
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/test.rs26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index e4d6a3f587b..61ffae47e2a 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -907,27 +907,25 @@ impl Step for RustdocGUI {
         // We remove existing folder to be sure there won't be artifacts remaining.
         let _ = fs::remove_dir_all(&out_dir);
 
-        let mut nb_generated = 0;
+        let src_path = "src/test/rustdoc-gui/src";
         // We generate docs for the libraries present in the rustdoc-gui's src folder.
-        let libs_dir = builder.build.src.join("src/test/rustdoc-gui/src");
-        for entry in libs_dir.read_dir().expect("read_dir call failed") {
-            let entry = entry.expect("invalid entry");
-            let path = entry.path();
-            if path.extension().map(|e| e == "rs").unwrap_or(false) {
-                let mut command = builder.rustdoc_cmd(self.compiler);
-                command.arg(path).arg("-o").arg(&out_dir);
-                builder.run(&mut command);
-                nb_generated += 1;
-            }
-        }
-        assert!(nb_generated > 0, "no documentation was generated...");
+        let mut cargo = Command::new(&builder.initial_cargo);
+        cargo
+            .arg("doc")
+            .arg("--workspace")
+            .arg("--target-dir")
+            .arg(&out_dir)
+            .env("RUSTDOC", builder.rustdoc(self.compiler))
+            .env("RUSTC", builder.rustc(self.compiler))
+            .current_dir(&builder.build.src.join(src_path));
+        builder.run(&mut cargo);
 
         // We now run GUI tests.
         let mut command = Command::new(&nodejs);
         command
             .arg(builder.build.src.join("src/tools/rustdoc-gui/tester.js"))
             .arg("--doc-folder")
-            .arg(out_dir)
+            .arg(out_dir.join("doc"))
             .arg("--tests-folder")
             .arg(builder.build.src.join("src/test/rustdoc-gui"));
         for path in &builder.paths {