about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbit-aloo <sshourya17@gmail.com>2025-06-17 20:58:19 +0530
committerbit-aloo <sshourya17@gmail.com>2025-06-17 21:10:55 +0530
commit186f5887725f72a73ed62f8bed95b7bb7b047739 (patch)
tree7206d68a0870d317662ecc30d4a481f466233836 /src/bootstrap
parent55e2c2681e30d8274e0c00a57f506f3dc2c3d36d (diff)
downloadrust-186f5887725f72a73ed62f8bed95b7bb7b047739.tar.gz
rust-186f5887725f72a73ed62f8bed95b7bb7b047739.zip
change to executed at
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/src/utils/exec.rs14
-rw-r--r--src/bootstrap/src/utils/execution_context.rs10
2 files changed, 13 insertions, 11 deletions
diff --git a/src/bootstrap/src/utils/exec.rs b/src/bootstrap/src/utils/exec.rs
index 85a19ebe368..eb9802bf2e1 100644
--- a/src/bootstrap/src/utils/exec.rs
+++ b/src/bootstrap/src/utils/exec.rs
@@ -2,11 +2,10 @@
 //!
 //! This module provides a structured way to execute and manage commands efficiently,
 //! ensuring controlled failure handling and output management.
-#![allow(warnings)]
 use std::ffi::OsStr;
 use std::fmt::{Debug, Formatter};
 use std::path::Path;
-use std::process::{Child, Command, CommandArgs, CommandEnvs, ExitStatus, Output, Stdio};
+use std::process::{Command, CommandArgs, CommandEnvs, ExitStatus, Output, Stdio};
 
 use build_helper::ci::CiEnv;
 use build_helper::drop_bomb::DropBomb;
@@ -73,7 +72,7 @@ pub struct BootstrapCommand {
     drop_bomb: DropBomb,
 }
 
-impl BootstrapCommand {
+impl<'a> BootstrapCommand {
     #[track_caller]
     pub fn new<S: AsRef<OsStr>>(program: S) -> Self {
         Command::new(program).into()
@@ -160,16 +159,19 @@ impl BootstrapCommand {
 
     /// Spawn the command in background, while capturing and returning all its output.
     #[track_caller]
-    pub fn start_capture(&mut self, exec_ctx: impl AsRef<ExecutionContext>) -> DeferredCommand {
+    pub fn start_capture(
+        &'a mut self,
+        exec_ctx: impl AsRef<ExecutionContext>,
+    ) -> DeferredCommand<'a> {
         exec_ctx.as_ref().start(self, OutputMode::Capture, OutputMode::Capture)
     }
 
     /// Spawn the command in background, while capturing and returning stdout, and printing stderr.
     #[track_caller]
     pub fn start_capture_stdout(
-        &mut self,
+        &'a mut self,
         exec_ctx: impl AsRef<ExecutionContext>,
-    ) -> DeferredCommand {
+    ) -> DeferredCommand<'a> {
         exec_ctx.as_ref().start(self, OutputMode::Capture, OutputMode::Print)
     }
 
diff --git a/src/bootstrap/src/utils/execution_context.rs b/src/bootstrap/src/utils/execution_context.rs
index 5417307e54f..a1b6ff94ca7 100644
--- a/src/bootstrap/src/utils/execution_context.rs
+++ b/src/bootstrap/src/utils/execution_context.rs
@@ -94,7 +94,7 @@ impl ExecutionContext {
         let executed_at = std::panic::Location::caller();
 
         if self.dry_run() && !command.run_always {
-            return DeferredCommand { process: None, stdout, stderr, command, created_at };
+            return DeferredCommand { process: None, stdout, stderr, command, executed_at };
         }
 
         #[cfg(feature = "tracing")]
@@ -110,7 +110,7 @@ impl ExecutionContext {
 
         let child = cmd.spawn().unwrap();
 
-        DeferredCommand { process: Some(child), stdout, stderr, command, created_at }
+        DeferredCommand { process: Some(child), stdout, stderr, command, executed_at }
     }
 
     /// Execute a command and return its output.
@@ -161,7 +161,7 @@ pub struct DeferredCommand<'a> {
     command: &'a mut BootstrapCommand,
     stdout: OutputMode,
     stderr: OutputMode,
-    created_at: Location<'a>,
+    executed_at: &'a Location<'a>,
 }
 
 impl<'a> DeferredCommand<'a> {
@@ -174,8 +174,8 @@ impl<'a> DeferredCommand<'a> {
 
         let output = self.process.take().unwrap().wait_with_output();
 
-        let created_at = self.created_at;
-        let executed_at = std::panic::Location::caller();
+        let created_at = self.command.get_created_location();
+        let executed_at = self.executed_at;
 
         use std::fmt::Write;