Skip to content

Commit

Permalink
Add assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
cgswords committed Feb 3, 2025
1 parent 488eeb3 commit e70d3cf
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ fn blocks(
}
}

// This invariant is enforced by the verifier's control flow analysis, but we double-check it
// here for sanity.
assert!(blocks.iter().last().unwrap().1.last().unwrap().is_unconditional_branch());

// (B) Record any instruction that is a fall-through target
// NB: the Move bytecode verifier enforces that the last block
let labels = blocks.keys().collect::<Vec<_>>();
for ((_, block), next) in blocks.iter().zip(labels.into_iter().skip(1)) {
// Check for fall-through
Expand Down

0 comments on commit e70d3cf

Please sign in to comment.