ir-gen: Fix ICE when reading an indexed ref mut array element#7644
ir-gen: Fix ICE when reading an indexed ref mut array element#7644Dnreikronos wants to merge 2 commits into
Conversation
A `ref mut` array argument is a pointer in IR, and storing it into a local adds another level of indirection, so the index-read path saw a pointer to a pointer to the array and aborted with `todo!()`. Peel the extra pointer levels before indexing, matching how the reassignment path already dereferences `ref mut` arguments. Closes FuelLabs#7602
|
Thanks for the contribution! Before we can merge this, we need @Dnreikronos to sign the Fuel Labs Contributor License Agreement. |
PR SummaryMedium Risk Overview Unsupported non-array/slice pointer targets no longer hit Reviewed by Cursor Bugbot for commit b7bcec1. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
@ironcev, can we re-trigger the cla pipe here and on the other PRs that I have open? |
Closes #7602
Reading an element of a
ref mutarray argument, likeself[i]inside animpl ... for [T; N]method, crashed the compiler. Aref mutargument is already a pointer in IR, and the argument gets stored into a local on entry, so by the time the index-read code runs the prefix is a pointer to a pointer to the array. That shape wasn't handled and fell into atodo!(). Writing through the sameself[i]worked because the reassignment path already dereferencesref mutarguments.The index-read path now peels off the extra pointer indirection before indexing, the way reassignment does, and the previously disabled
assert_eq(self[i], default)line in the const-generics reassignment test is back on.