Root-cause iterator-simple stuck state after drop-glue support#1066
Draft
Stevengre wants to merge 2 commits into
Draft
Root-cause iterator-simple stuck state after drop-glue support#1066Stevengre wants to merge 2 commits into
Stevengre wants to merge 2 commits into
Conversation
Remove the two temporary bridge rules added for the drop-glue path. The bare-value-to-Range wrapper for PointerOffset and the Union-unwrap for Field on Range are symptoms of a deeper design issue in how #typeProjection stores per-element type projections in PLACEPROJ for slice-to-slice PtrToPtr casts, which conflicts with PointerOffset positioning. The Union-unwrap rule parallels the existing Aggregate-unwrap rule (line 503-509) but was added as a workaround rather than addressing the root cause. The bare-to-Range rule papered over PointerOffset receiving non-Range values. Both are tracked in #1011 for a proper structural fix.
With the bridge rules removed, iterator-simple gets stuck on Range(ListItem(Union(...))) + Field projection, exposing the #typeProjection design issue tracked in #1011. Rename to -unsupported-fail and add show snapshot.
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.
Summary
Adding drop function (
drop_in_place) support causediterator-simpleto get stuck during proof. This PR investigates the root cause and applies a structural fix rather than papering over the symptoms with temporary bridge rules.Root cause
When dropping
IntoIter(which contains[MaybeUninit<T>; N]),PtrToPtrcasts append type-projection projections to a pointer'sPLACEPROJ:When a deref rule later appends
PointerOffset(N)at the end viaappendP, the traversal order becomes:PointerOffsetexpects aRange(array) but receives a scalarT. The correct semantic order is PointerOffset first (array-level element selection), then type projection (per-element type conversion).Fix:
insertPOBeforeTypeProjInstead of blindly appending
PointerOffsetat the end ofPLACEPROJ, the newinsertPOBeforeTypeProjfunction scans the projection list forCI(0, 0, false)— the distinctive marker of type projections fromPtrToPtrcasts (normal MIRConstantIndexuses non-zero array lengths) — and merges the pointer offset into it:CI(0+OFF, 0, false).This produces the correct traversal:
When no
CI(0,0,false)is found, it falls back to appendingPointerOffsetat the end (preserving existing behavior for non-PtrToPtr cases).Other changes
_projected_ty): compute the correct result array length from Subslice parametersremoveIndexTail-related workaround from RawPtr aggregate constructionconsPHACK rule: no longer the primary mechanism (kept as optimization)iterator-simpleas a passing testTest plan
iterator-simplepasses (restored from unsupported-fail)subslice-drop-unsupported-failpasses as expected-fail_projected_tyunit test passesmake checkpasses🤖 Generated with Claude Code