Skip to content

Conversation

@dkcumming
Copy link
Collaborator

@dkcumming dkcumming commented Jan 19, 2026

When iterating through a collection, the elements of the the range of the collection are transmuted from T to std::mem::MaybeUninit<T>. Previously this thunked (as can be seen in the run-smir-random tests), but the new rules allow for element-wise transmutation specifically for the case seen in iterators.

Not added in this PR is the ability to read from these which is a more complicated process of interpretting a PtrToPtr conversion on a transparent wrapper types which do not currently support non-zero union field access. This is a problem for this as field 1 of MaybeUninit corresponds to the case that is initialised. See #914

@dkcumming dkcumming self-assigned this Jan 19, 2026
Copy link
Member

@jberthold jberthold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

@automergerpr-permission-manager automergerpr-permission-manager bot merged commit 7ddce12 into master Jan 19, 2026
7 checks passed
@automergerpr-permission-manager automergerpr-permission-manager bot deleted the dc/iterators branch January 19, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants