Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[compiletest-related cleanups 1/7] Cleanup is_rustdoc logic and remove a useless path join in rustdoc-json runtest logic #136441

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions src/tools/compiletest/src/runtest/rustdoc_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Comment on lines -25 to +24
Copy link
Member Author

@jieyouxu jieyouxu Feb 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This currently is useless because out_dir is an absolute path, so root.join(&out_dir) will just become out_dir. This would be actually wrong if out_dir was a relative path, because build dir is not necessarily under source root (such as in CI).

.arg("--template")
.arg(&self.testpaths.file),
);
Expand Down
Loading