Skip to content

Commit a768afe

Browse files
committed
Fix tracking of prev_pos
1 parent ad2fd11 commit a768afe

File tree

1 file changed

+5
-2
lines changed
  • cranelift/codegen/src/legalizer

1 file changed

+5
-2
lines changed

cranelift/codegen/src/legalizer/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,11 @@ fn forward_walk(
7373
) {
7474
let mut pos = FuncCursor::new(func);
7575
while let Some(_block) = pos.next_block() {
76-
let prev_pos = pos.position();
77-
while let Some(inst) = pos.next_inst() {
76+
let mut prev_pos;
77+
while let Some(inst) = {
78+
prev_pos = pos.position();
79+
pos.next_inst()
80+
} {
7881
match f(pos.func, inst) {
7982
WalkCommand::Continue => continue,
8083
WalkCommand::Revisit => pos.set_position(prev_pos),

0 commit comments

Comments
 (0)