about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-05-06 12:00:44 +0000
committerbors <bors@rust-lang.org>2024-05-06 12:00:44 +0000
commit25e3949aa1b24b3f62a72c1f713830aa1d1efcd4 (patch)
treee894a9f5f82c0d455c01a596ede8dc28b22dc350 /src
parent8cef37dbb67e9c80702925f19cf298c4203991e4 (diff)
parent34fe2172b16fb9d80c76e51ab4703bd297d630fe (diff)
Auto merge of #124753 - GuillaumeGomez:migrate-rustdoc-determinism, r=jieyouxu
Migrate `run-make/rustdoc-error-lines` to new `rmake.rs`

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

There was a weird naming inconsistency with `input`/`output`. A few tests write `.arg("-o").arg(path)` and the `output` method was actually the command output. So instead, I renamed the original `output` into `command_output` so that I could create the `output` method with the expected effect (and updated the tests to use it too).

EDIT: The first two commits come from https://github.com/rust-lang/rust/pull/124711. Some weird things happened recently pparently. ^^'

r? `@jieyouxu`
Diffstat (limited to 'src')
-rw-r--r--src/tools/run-make-support/src/cc.rs2
-rw-r--r--src/tools/run-make-support/src/clang.rs2
-rw-r--r--src/tools/run-make-support/src/lib.rs6
-rw-r--r--src/tools/run-make-support/src/llvm_readobj.rs2
-rw-r--r--src/tools/run-make-support/src/rustc.rs11
-rw-r--r--src/tools/run-make-support/src/rustdoc.rs18
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt2
7 files changed, 31 insertions, 12 deletions
diff --git a/src/tools/run-make-support/src/cc.rs b/src/tools/run-make-support/src/cc.rs
index 4082639f618..a67f5c8a9ee 100644
--- a/src/tools/run-make-support/src/cc.rs
+++ b/src/tools/run-make-support/src/cc.rs
@@ -73,7 +73,7 @@ impl Cc {
     }
 
     /// Get the [`Output`][::std::process::Output] of the finished process.
-    pub fn output(&mut self) -> ::std::process::Output {
+    pub fn command_output(&mut self) -> ::std::process::Output {
         self.cmd.output().expect("failed to get output of finished process")
     }
 }
diff --git a/src/tools/run-make-support/src/clang.rs b/src/tools/run-make-support/src/clang.rs
index c30ba29ed76..6ccce67b250 100644
--- a/src/tools/run-make-support/src/clang.rs
+++ b/src/tools/run-make-support/src/clang.rs
@@ -72,7 +72,7 @@ impl Clang {
     }
 
     /// Get the [`Output`][::std::process::Output] of the finished process.
-    pub fn output(&mut self) -> ::std::process::Output {
+    pub fn command_output(&mut self) -> ::std::process::Output {
         self.cmd.output().expect("failed to get output of finished process")
     }
 }
diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs
index d040b05f20e..9888ca2d1ed 100644
--- a/src/tools/run-make-support/src/lib.rs
+++ b/src/tools/run-make-support/src/lib.rs
@@ -164,7 +164,7 @@ pub fn set_host_rpath(cmd: &mut Command) {
 ///
 /// impl CommandWrapper {
 ///     /// Get the [`Output`][::std::process::Output] of the finished process.
-///     pub fn output(&mut self) -> Output { /* ... */ } // <- required `output()` method
+///     pub fn command_output(&mut self) -> Output { /* ... */ } // <- required `command_output()` method
 /// }
 ///
 /// crate::impl_common_helpers!(CommandWrapper);
@@ -242,7 +242,7 @@ macro_rules! impl_common_helpers {
                 let caller_location = ::std::panic::Location::caller();
                 let caller_line_number = caller_location.line();
 
-                let output = self.output();
+                let output = self.command_output();
                 if !output.status.success() {
                     handle_failed_output(&self.cmd, output, caller_line_number);
                 }
@@ -255,7 +255,7 @@ macro_rules! impl_common_helpers {
                 let caller_location = ::std::panic::Location::caller();
                 let caller_line_number = caller_location.line();
 
-                let output = self.output();
+                let output = self.command_output();
                 if output.status.success() {
                     handle_failed_output(&self.cmd, output, caller_line_number);
                 }
diff --git a/src/tools/run-make-support/src/llvm_readobj.rs b/src/tools/run-make-support/src/llvm_readobj.rs
index 4e1f2b002f3..f114aacfa3f 100644
--- a/src/tools/run-make-support/src/llvm_readobj.rs
+++ b/src/tools/run-make-support/src/llvm_readobj.rs
@@ -44,7 +44,7 @@ impl LlvmReadobj {
 
     /// Get the [`Output`][::std::process::Output] of the finished process.
     #[track_caller]
-    pub fn output(&mut self) -> ::std::process::Output {
+    pub fn command_output(&mut self) -> ::std::process::Output {
         self.cmd.output().expect("failed to get output of finished process")
     }
 }
diff --git a/src/tools/run-make-support/src/rustc.rs b/src/tools/run-make-support/src/rustc.rs
index 37539528ab3..de773d688ef 100644
--- a/src/tools/run-make-support/src/rustc.rs
+++ b/src/tools/run-make-support/src/rustc.rs
@@ -91,6 +91,13 @@ impl Rustc {
         self
     }
 
+    /// Specify path to the output file.
+    pub fn output<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
+        self.cmd.arg("-o");
+        self.cmd.arg(path.as_ref());
+        self
+    }
+
     /// This flag defers LTO optimizations to the linker.
     pub fn linker_plugin_lto(&mut self, option: &str) -> &mut Self {
         self.cmd.arg(format!("-Clinker-plugin-lto={option}"));
@@ -171,7 +178,7 @@ impl Rustc {
 
     /// Get the [`Output`][::std::process::Output] of the finished process.
     #[track_caller]
-    pub fn output(&mut self) -> ::std::process::Output {
+    pub fn command_output(&mut self) -> ::std::process::Output {
         // let's make sure we piped all the input and outputs
         self.cmd.stdin(Stdio::piped());
         self.cmd.stdout(Stdio::piped());
@@ -196,7 +203,7 @@ impl Rustc {
         let caller_location = std::panic::Location::caller();
         let caller_line_number = caller_location.line();
 
-        let output = self.output();
+        let output = self.command_output();
         if output.status.code().unwrap() != code {
             handle_failed_output(&self.cmd, output, caller_line_number);
         }
diff --git a/src/tools/run-make-support/src/rustdoc.rs b/src/tools/run-make-support/src/rustdoc.rs
index c2c4f2e68e2..aa3c7dcf0e3 100644
--- a/src/tools/run-make-support/src/rustdoc.rs
+++ b/src/tools/run-make-support/src/rustdoc.rs
@@ -51,6 +51,13 @@ 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.
     pub fn out_dir<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
         self.cmd.arg("--out-dir").arg(path.as_ref());
@@ -73,7 +80,7 @@ impl Rustdoc {
 
     /// Get the [`Output`][::std::process::Output] of the finished process.
     #[track_caller]
-    pub fn output(&mut self) -> ::std::process::Output {
+    pub fn command_output(&mut self) -> ::std::process::Output {
         // let's make sure we piped all the input and outputs
         self.cmd.stdin(Stdio::piped());
         self.cmd.stdout(Stdio::piped());
@@ -93,12 +100,19 @@ impl Rustdoc {
         }
     }
 
+    /// Specify the edition year.
+    pub fn edition(&mut self, edition: &str) -> &mut Self {
+        self.cmd.arg("--edition");
+        self.cmd.arg(edition);
+        self
+    }
+
     #[track_caller]
     pub fn run_fail_assert_exit_code(&mut self, code: i32) -> Output {
         let caller_location = std::panic::Location::caller();
         let caller_line_number = caller_location.line();
 
-        let output = self.output();
+        let output = self.command_output();
         if output.status.code().unwrap() != code {
             handle_failed_output(&self.cmd, output, caller_line_number);
         }
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index d4d6c1460ce..f4ae7b06cdb 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -44,7 +44,6 @@ run-make/dep-graph/Makefile
 run-make/dep-info-doesnt-run-much/Makefile
 run-make/dep-info-spaces/Makefile
 run-make/dep-info/Makefile
-run-make/doctests-runtool/Makefile
 run-make/dump-ice-to-disk/Makefile
 run-make/dump-mono-stats/Makefile
 run-make/duplicate-output-flavors/Makefile
@@ -245,7 +244,6 @@ run-make/rlib-format-packed-bundled-libs-3/Makefile
 run-make/rlib-format-packed-bundled-libs/Makefile
 run-make/rmeta-preferred/Makefile
 run-make/rustc-macro-dep-files/Makefile
-run-make/rustdoc-error-lines/Makefile
 run-make/rustdoc-io-error/Makefile
 run-make/rustdoc-map-file/Makefile
 run-make/rustdoc-output-path/Makefile