diff --git a/src/rt/rust_shape.h b/src/rt/rust_shape.h index 2ce4fcb5645..e568d480164 100644 --- a/src/rt/rust_shape.h +++ b/src/rt/rust_shape.h @@ -868,11 +868,12 @@ data::walk_fn_contents(bool align, ptr &dp) { dp += sizeof(void *); // Skip over the code pointer. uint8_t *box_ptr = bump_dp(dp); + if (!box_ptr) + return; + type_desc *subtydesc = *reinterpret_cast(box_ptr + sizeof(void *)); ptr closure_dp(box_ptr + sizeof(void *)); - if (!box_ptr) - return; arena arena; type_param *params = type_param::from_fn_shape(subtydesc->shape,