about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-06-20 11:21:56 -0400
committerOneirical <manchot@videotron.ca>2024-06-28 11:18:46 -0400
commitacb6078d9183c41e39495ff075cd01b3d68fe967 (patch)
tree97e3a678623e6adcd77e72d4856cf6501f0453cc /src
parent99f77a2eda555b50b518f74823ab636a20efb87f (diff)
downloadrust-acb6078d9183c41e39495ff075cd01b3d68fe967.tar.gz
rust-acb6078d9183c41e39495ff075cd01b3d68fe967.zip
rewrite remap-path-prefix to rmake
Diffstat (limited to 'src')
-rw-r--r--src/tools/run-make-support/src/rustc.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/tools/run-make-support/src/rustc.rs b/src/tools/run-make-support/src/rustc.rs
index 28ece1dff12..df843d74fc9 100644
--- a/src/tools/run-make-support/src/rustc.rs
+++ b/src/tools/run-make-support/src/rustc.rs
@@ -106,6 +106,17 @@ impl Rustc {
         self
     }
 
+    /// Remap source path prefixes in all output.
+    pub fn remap_path_prefix<P: AsRef<Path>>(&mut self, from: P, to: P) -> &mut Self {
+        let from = from.as_ref().to_string_lossy();
+        let to = to.as_ref().to_string_lossy();
+
+        self.cmd.arg("--remap-path-prefix");
+        self.cmd.arg(format!("{from}={to}"));
+
+        self
+    }
+
     /// Specify path to the input file.
     pub fn input<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
         self.cmd.arg(path.as_ref());