Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cordyceps): pin CursorMut iterator Items #240

Merged
merged 3 commits into from
Jun 23, 2022
Merged

fix(cordyceps): pin CursorMut iterator Items #240

merged 3 commits into from
Jun 23, 2022

Conversation

hawkw
Copy link
Owner

@hawkw hawkw commented Jun 23, 2022

Currently, the Item type of list::CursorMut's Iterator impl is
&mut T. This is incorrect, as it allows the items to be moved out of
the list without unlinking them. Instead, the iterator's item type must
be Pinned. PR #209 made this change for the IterMut type, but did
not make the same change for CursorMut, so this commit fixes
CursorMut similarly.

BREAKING CHANGE:

This changes the type signature of the Iterator impl for
list::CursorMut.

Currently, the `Item` type of `list::CursorMut`'s `Iterator` impl is
`&mut T`. This is incorrect, as it allows the items to be moved out of
the list without unlinking them. Instead, the iterator's item type must
be `Pin`ned. PR #209 made this change for the `IterMut` type, but did
not make the same change for `CursorMut`, so this commit fixes
`CursorMut` similarly.

BREAKING CHANGE:

This changes the type signature of the `Iterator` impl for
`list::CursorMut`.
@hawkw hawkw enabled auto-merge (squash) June 23, 2022 16:25
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 23, 2022
This branch adds an immutable cursor to `cordyceps::list`, in addition
to the existing mutable cursor. This functions similarly to the
`std::collections::linked_list::Cursor` type.

Depends on #240.
@hawkw hawkw merged commit 5ee31ce into main Jun 23, 2022
@hawkw hawkw deleted the eliza/pin-iters branch June 23, 2022 17:01
hawkw added a commit that referenced this pull request Jun 23, 2022
This branch adds an immutable cursor to `cordyceps::list`, in addition
to the existing mutable cursor. This functions similarly to the
`std::collections::linked_list::Cursor` type.

Depends on #240.
hawkw added a commit that referenced this pull request Jun 23, 2022
This branch adds an immutable cursor to `cordyceps::list`, in addition
to the existing mutable cursor. This functions similarly to the
`std::collections::linked_list::Cursor` type.

Depends on #240.
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.

None yet

1 participant