Skip to content

Conversation

@Stevengre
Copy link
Contributor

…871)

The change in #811 allows pointer casts between pointers to data and
pointers to "transparent wrapper structs" containing one field with the
same data. While the code tries to insert `field(0, _)` projections when
casting, this remediation falls short when the cast pointer is of a
second degree, i.e., a pointer to a pointer.
An example of this can be observed in `Iterator<_>::next`, where a
pointer `**T` is cast to a pointer `*NonNull<T>`, `NonNull` being one of
these "transparent wrapper structs".

The proposed code change allows for a `field(0, _)` projection to be
treated as a No-Op when applied to a non-aggregate (nor union),
specifically a `PtrLocal` for the case of `next()`.

This fixes `iter.next()` for cases where `Some(element)` is returned.
The case where it returns `None` is a separate issue tested but not
fixed here.
@Stevengre Stevengre merged commit 796b2d5 into feature/p-token Dec 1, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants