Repository: rigetti/quil-rs (language: python)

Issue:
The looping utility needs to apply the end label at the end of the program.
The `wrap_in_loop` utility doesn't include a `LABEL @end-label` at the end of the program, which makes it impossible to jump to when the loop should end.


Discussion / hints:

Fix patch:
diff --git a/quil-rs/src/program/mod.rs b/quil-rs/src/program/mod.rs
index e23589fd..e8f18333 100644
--- a/quil-rs/src/program/mod.rs
+++ b/quil-rs/src/program/mod.rs
@@ -455,6 +455,7 @@ impl Program {
                 Instruction::Jump(Jump {
                     target: start_target,
                 }),
+                Instruction::Label(Label { target: end_target }),
             ])
             .collect::<Vec<Instruction>>(),
         );


Test patch:
diff --git a/quil-rs/src/program/snapshots/quil_rs__program__tests__wrap_in_loop.snap b/quil-rs/src/program/snapshots/quil_rs__program__tests__wrap_in_loop.snap
index 695ae589..7d7f44e0 100644
--- a/quil-rs/src/program/snapshots/quil_rs__program__tests__wrap_in_loop.snap
+++ b/quil-rs/src/program/snapshots/quil_rs__program__tests__wrap_in_loop.snap
@@ -20,4 +20,5 @@ I 0
 SUB shot_count[0] 1
 JUMP-UNLESS @loop-end shot_count[0]
 JUMP @loop-start
+LABEL @loop-end