diff --git a/src/protocol/tests/utils.rs b/src/protocol/tests/utils.rs index 735cbdc11c4a0e1c5eeb1c13f21d34f281ea3d49..d0694aa883873531183aedd7c23ba71dee352d16 100644 --- a/src/protocol/tests/utils.rs +++ b/src/protocol/tests/utils.rs @@ -600,7 +600,8 @@ impl<'a> FunctionTester<'a> { // Find the first occurrence of the expression after the definition of // the function, we'll check that it is included in the body later. - let mut outer_match_idx = self.def.span.begin.offset as usize; + let body = &self.ctx.heap[self.def.body]; + let mut outer_match_idx = body.span.begin.offset as usize; while outer_match_idx < module.source.input.len() { if module.source.input[outer_match_idx..].starts_with(outer_match.as_bytes()) { break;