Skip to content

Commit 897021a

Browse files
committed
make DeferredCommand a must use and move mark_as_executed inside finish process
1 parent b0193c6 commit 897021a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/bootstrap/src/utils/execution_context.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ enum CommandState<'a> {
4040
},
4141
}
4242

43+
#[must_use]
4344
pub struct DeferredCommand<'a> {
4445
state: CommandState<'a>,
4546
}
@@ -122,11 +123,11 @@ impl ExecutionContext {
122123
stdout: OutputMode,
123124
stderr: OutputMode,
124125
) -> DeferredCommand<'a> {
125-
command.mark_as_executed();
126126
let cache_key = command.cache_key();
127127

128128
if let Some(cached_output) = cache_key.as_ref().and_then(|key| self.command_cache.get(key))
129129
{
130+
command.mark_as_executed();
130131
self.verbose(|| println!("Cache hit: {command:?}"));
131132
return DeferredCommand { state: CommandState::Cached(cached_output) };
132133
}
@@ -244,6 +245,8 @@ impl<'a> DeferredCommand<'a> {
244245
executed_at: &'a std::panic::Location<'a>,
245246
exec_ctx: &ExecutionContext,
246247
) -> CommandOutput {
248+
command.mark_as_executed();
249+
247250
let process = match process.take() {
248251
Some(p) => p,
249252
None => return CommandOutput::default(),

0 commit comments

Comments
 (0)