diff options
| author | bit-aloo <sshourya17@gmail.com> | 2025-06-25 00:52:02 +0530 |
|---|---|---|
| committer | bit-aloo <sshourya17@gmail.com> | 2025-06-27 10:38:44 +0530 |
| commit | 18090924f98c095cf001626df293d79246bb271f (patch) | |
| tree | 4365872556d7c2c9cd1db4cb3ebc7ba6e638a9f6 | |
| parent | 28f97108f1a2446bb41cb34b57c98a402631b0b5 (diff) | |
| download | rust-18090924f98c095cf001626df293d79246bb271f.tar.gz rust-18090924f98c095cf001626df293d79246bb271f.zip | |
make DeferredCommand a must use and move mark_as_executed inside finish process
| -rw-r--r-- | src/bootstrap/src/utils/execution_context.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bootstrap/src/utils/execution_context.rs b/src/bootstrap/src/utils/execution_context.rs index e25dfb501cf..3076469f395 100644 --- a/src/bootstrap/src/utils/execution_context.rs +++ b/src/bootstrap/src/utils/execution_context.rs @@ -40,6 +40,7 @@ enum CommandState<'a> { }, } +#[must_use] pub struct DeferredCommand<'a> { state: CommandState<'a>, } @@ -122,11 +123,11 @@ impl ExecutionContext { stdout: OutputMode, stderr: OutputMode, ) -> DeferredCommand<'a> { - command.mark_as_executed(); let cache_key = command.cache_key(); if let Some(cached_output) = cache_key.as_ref().and_then(|key| self.command_cache.get(key)) { + command.mark_as_executed(); self.verbose(|| println!("Cache hit: {command:?}")); return DeferredCommand { state: CommandState::Cached(cached_output) }; } @@ -244,6 +245,8 @@ impl<'a> DeferredCommand<'a> { executed_at: &'a std::panic::Location<'a>, exec_ctx: &ExecutionContext, ) -> CommandOutput { + command.mark_as_executed(); + let process = match process.take() { Some(p) => p, None => return CommandOutput::default(), |
