Repository navigation
Conversation
unelaborate_derefs visited blocks in index order, recording a deref temp's replacement only when it reached the defining statement. Drop elaboration can number a cleanup block that uses a box-deref temp before the cleanup block that defines it (the unwind path dropping a box's contents after `*b` is moved out). That use was left in place while its definition became a Nop, so the temp's `*const T` type was live up to the function entry and building block templates panicked with `unrefined_ty: *const T`. Visit blocks in reverse postorder, where a temp's defining block, which dominates its uses, always comes first. Fixes #357 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hw71PvwhBTUpfmvDdSGkXL
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #357
unelaborate_derefsvisited basic blocks in index order and recorded a deref temp's replacement only when it reached the statement that defines the temp. Drop elaboration can give a cleanup block that uses a box-deref temp a lower index than the cleanup block that defines it. This happens on the unwind path that drops a box's contents after*bis moved out. That use was left as it was while the definition became aNop, so the temp's*const Twas live all the way up to the function entry.refine_basic_blocksthen panicked withunrefined_ty: *const T.The fix visits blocks in reverse postorder. A temp's defining block dominates its uses, so in that order it is always visited first.
src/analyze/local_def.rs: iteratebasic_blocks.reverse_postorder()inunelaborate_derefs.tests/ui/{pass,fail}/box_move_out_after_call.rs: moving out of aBox<Box<i64>>after aBox::newcall. Onmainthis panics. With the fix it verifies, and a wrong assertion isUnsat.The issue's other reproductions (list reversal
cur = *rest,swap_head) also verify with this change, and a wrong assertion in each is still rejected.cargo test(402 UI tests, PCSat installed as in CI),cargo fmt --checkandcargo clippy -D warningsall pass locally.Generated by Claude Code