about summary refs log tree commit diff
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-02-03 19:13:28 +0800
committerGitHub <noreply@github.com>2025-02-03 19:13:28 +0800
commitbdc6b4def56169f45693a5be90de4e16b4c11a7f (patch)
treeb39440689622f28ef4ca76ed9855e2a189dff41c
parent43764db758fd404083f22d0bde747b5ce5ca1cfa (diff)
parent4d0cb4213b14457db5eb3ad21b1a65d5a91dd1ba (diff)
downloadrust-bdc6b4def56169f45693a5be90de4e16b4c11a7f.tar.gz
rust-bdc6b4def56169f45693a5be90de4e16b4c11a7f.zip
Rollup merge of #136441 - jieyouxu:cleanup-is-rustdoc, r=compiler-errors
[`compiletest`-related cleanups 1/7] Cleanup `is_rustdoc` logic and remove a useless path join in rustdoc-json runtest logic

Reference for overall changes: https://github.com/rust-lang/rust/pull/136437
Part **1** of **7** of the *`compiletest`-related cleanups* PR series.

### Summary

- Don't match on path when we already have test suite names.
- Remove a useless path join.

r? bootstrap (or compiler)
-rw-r--r--src/tools/compiletest/src/runtest.rs4
-rw-r--r--src/tools/compiletest/src/runtest/rustdoc_json.rs3
2 files changed, 2 insertions, 5 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index ca48abda5fc..0e2da2b02ca 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1417,9 +1417,7 @@ impl<'test> TestCx<'test> {
     }
 
     fn is_rustdoc(&self) -> bool {
-        self.config.src_base.ends_with("rustdoc-ui")
-            || self.config.src_base.ends_with("rustdoc-js")
-            || self.config.src_base.ends_with("rustdoc-json")
+        matches!(self.config.suite.as_str(), "rustdoc-ui" | "rustdoc-js" | "rustdoc-json")
     }
 
     fn get_mir_dump_dir(&self) -> PathBuf {
diff --git a/src/tools/compiletest/src/runtest/rustdoc_json.rs b/src/tools/compiletest/src/runtest/rustdoc_json.rs
index 31fdb0a5d13..bf7eb2e109a 100644
--- a/src/tools/compiletest/src/runtest/rustdoc_json.rs
+++ b/src/tools/compiletest/src/runtest/rustdoc_json.rs
@@ -16,13 +16,12 @@ impl TestCx<'_> {
             self.fatal_proc_rec("rustdoc failed!", &proc_res);
         }
 
-        let root = self.config.find_rust_src_root().unwrap();
         let mut json_out = out_dir.join(self.testpaths.file.file_stem().unwrap());
         json_out.set_extension("json");
         let res = self.run_command_to_procres(
             Command::new(self.config.jsondocck_path.as_ref().unwrap())
                 .arg("--doc-dir")
-                .arg(root.join(&out_dir))
+                .arg(&out_dir)
                 .arg("--template")
                 .arg(&self.testpaths.file),
         );