Skip to content

Commit

Permalink
Rollup merge of rust-lang#129122 - GuillaumeGomez:remove-duplicated-r…
Browse files Browse the repository at this point in the history
…ustdoc-output-methods, r=Kobzol

Remove duplicated `Rustdoc::output` method from `run-make-support` lib

I discovered recently that `--output` is deprecated in rustdoc and that `--out-dir` is doing the exact same thing. To keep things along with the current rustdoc status, I removed the `Rustdoc::output` method.

cc `@jieyouxu`
r? `@Kobzol`
  • Loading branch information
GuillaumeGomez authored Aug 15, 2024
2 parents ce5775c + d562a4a commit efb59ed
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 27 deletions.
8 changes: 1 addition & 7 deletions src/tools/run-make-support/src/external_deps/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,8 @@ impl Rustdoc {
self
}

/// Specify path to the output folder.
pub fn output<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
self.cmd.arg("-o");
self.cmd.arg(path.as_ref());
self
}

/// Specify output directory.
#[doc(alias = "output")]
pub fn out_dir<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
self.cmd.arg("--out-dir").arg(path.as_ref());
self
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/deref-impl-rustdoc-ice/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ use run_make_support::{cwd, rustc, rustdoc};
fn main() {
rustc().input("foo.rs").run();
rustc().input("bar.rs").run();
rustdoc().input("baz.rs").library_search_path(cwd()).output(cwd()).run();
rustdoc().input("baz.rs").library_search_path(cwd()).out_dir(cwd()).run();
}
6 changes: 3 additions & 3 deletions tests/run-make/emit-shared-files/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn main() {
rustdoc()
.arg("-Zunstable-options")
.arg("--emit=invocation-specific")
.output("invocation-only")
.out_dir("invocation-only")
.arg("--resource-suffix=-xxx")
.args(&["--theme", "y.css"])
.args(&["--extend-css", "z.css"])
Expand All @@ -34,7 +34,7 @@ fn main() {
rustdoc()
.arg("-Zunstable-options")
.arg("--emit=toolchain-shared-resources")
.output("toolchain-only")
.out_dir("toolchain-only")
.arg("--resource-suffix=-xxx")
.args(&["--extend-css", "z.css"])
.input("x.rs")
Expand Down Expand Up @@ -68,7 +68,7 @@ fn main() {
rustdoc()
.arg("-Zunstable-options")
.arg("--emit=toolchain-shared-resources,unversioned-shared-resources")
.output("all-shared")
.out_dir("all-shared")
.arg("--resource-suffix=-xxx")
.args(&["--extend-css", "z.css"])
.input("x.rs")
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/exit-code/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn main() {
.run_fail()
.assert_exit_code(101);

rustdoc().arg("success.rs").output("exit-code").run();
rustdoc().arg("success.rs").out_dir("exit-code").run();

rustdoc().arg("--invalid-arg-foo").run_fail().assert_exit_code(1);

Expand Down
8 changes: 4 additions & 4 deletions tests/run-make/rustdoc-determinism/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ use run_make_support::{diff, rustdoc};

fn main() {
let foo_first = Path::new("foo_first");
rustdoc().input("foo.rs").output(&foo_first).run();
rustdoc().input("bar.rs").output(&foo_first).run();
rustdoc().input("foo.rs").out_dir(&foo_first).run();
rustdoc().input("bar.rs").out_dir(&foo_first).run();

let bar_first = Path::new("bar_first");
rustdoc().input("bar.rs").output(&bar_first).run();
rustdoc().input("foo.rs").output(&bar_first).run();
rustdoc().input("bar.rs").out_dir(&bar_first).run();
rustdoc().input("foo.rs").out_dir(&bar_first).run();

diff()
.expected_file(foo_first.join("search-index.js"))
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/rustdoc-io-error/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn main() {
permissions.set_readonly(true);
rfs::set_permissions(&out_dir, permissions);

let output = rustdoc().input("foo.rs").output(&out_dir).env("RUST_BACKTRACE", "1").run_fail();
let output = rustdoc().input("foo.rs").out_dir(&out_dir).env("RUST_BACKTRACE", "1").run_fail();

rfs::set_permissions(&out_dir, original_permissions);

Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/rustdoc-map-file/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() {
.input("foo.rs")
.arg("-Zunstable-options")
.arg("--generate-redirect-map")
.output(&out_dir)
.out_dir(&out_dir)
.run();
// FIXME (GuillaumeGomez): Port the python script to Rust as well.
python_command().arg("validate_json.py").arg(&out_dir).run();
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/rustdoc-output-path/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ use run_make_support::rustdoc;

fn main() {
let out_dir = Path::new("foo/bar/doc");
rustdoc().input("foo.rs").output(&out_dir).run();
rustdoc().input("foo.rs").out_dir(&out_dir).run();
assert!(out_dir.exists());
}
2 changes: 1 addition & 1 deletion tests/run-make/rustdoc-output-stdout/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn main() {
// First we check that we generate the JSON in the stdout.
rustdoc()
.input("foo.rs")
.output("-")
.out_dir("-")
.arg("-Zunstable-options")
.output_format("json")
.run()
Expand Down
4 changes: 2 additions & 2 deletions tests/run-make/rustdoc-scrape-examples-macros/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn main() {
.input("examples/ex.rs")
.crate_name("ex")
.crate_type("bin")
.output(&out_dir)
.out_dir(&out_dir)
.extern_(crate_name, rust_lib_name(crate_name))
.extern_(proc_crate_name, dylib_name.trim())
.arg("-Zunstable-options")
Expand All @@ -49,7 +49,7 @@ fn main() {
.input("src/lib.rs")
.crate_name(crate_name)
.crate_type("lib")
.output(&out_dir)
.out_dir(&out_dir)
.arg("-Zunstable-options")
.arg("--with-examples")
.arg(&ex_dir)
Expand Down
4 changes: 2 additions & 2 deletions tests/run-make/rustdoc-scrape-examples-remap/scrape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub fn scrape(extra_args: &[&str]) {
.input(&dep)
.crate_name(&dep_stem)
.crate_type("bin")
.output(&out_dir)
.out_dir(&out_dir)
.extern_(crate_name, format!("lib{crate_name}.rmeta"))
.arg("-Zunstable-options")
.arg("--scrape-examples-output-path")
Expand All @@ -35,7 +35,7 @@ pub fn scrape(extra_args: &[&str]) {
let mut rustdoc = rustdoc();
rustdoc
.input("src/lib.rs")
.output(&out_dir)
.out_dir(&out_dir)
.crate_name(crate_name)
.crate_type("lib")
.arg("-Zunstable-options");
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/rustdoc-target-spec-json-path/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn main() {
rustc().crate_type("lib").input("dummy_core.rs").target("target.json").run();
rustdoc()
.input("my_crate.rs")
.output(out_dir)
.out_dir(out_dir)
.library_search_path(cwd())
.target("target.json")
.run();
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/rustdoc-themes/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ fn main() {
rfs::create_dir_all(&out_dir);
rfs::write(&test_css, test_content);

rustdoc().output(&out_dir).input("foo.rs").arg("--theme").arg(&test_css).run();
rustdoc().out_dir(&out_dir).input("foo.rs").arg("--theme").arg(&test_css).run();
htmldocck().arg(out_dir).arg("foo.rs").run();
}
2 changes: 1 addition & 1 deletion tests/run-make/rustdoc-with-out-dir-option/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ use run_make_support::{htmldocck, rustdoc};

fn main() {
let out_dir = "rustdoc";
rustdoc().input("src/lib.rs").crate_name("foobar").crate_type("lib").output(&out_dir).run();
rustdoc().input("src/lib.rs").crate_name("foobar").crate_type("lib").out_dir(&out_dir).run();
htmldocck().arg(out_dir).arg("src/lib.rs").run();
}

0 comments on commit efb59ed

Please sign in to comment.