diff --git a/compiler/passes/src/code_generation/visit_program.rs b/compiler/passes/src/code_generation/visit_program.rs index 9c92ec6cb6..ae2d479c6a 100644 --- a/compiler/passes/src/code_generation/visit_program.rs +++ b/compiler/passes/src/code_generation/visit_program.rs @@ -225,7 +225,7 @@ impl<'a> CodeGenerator<'a> { // If the function contained calls that produced futures, then we need to add the futures to the finalize block as input. // Store the new future registers. let mut future_registers = Vec::new(); - for (_, future_type) in &self.futures { + for (_, future_type) in self.futures.drain(..) { let register_string = format!("r{}", self.next_register); writeln!(function_string, " input {register_string} as {future_type}.future;") .expect("failed to write to string");