Skip to content

Add explicit ownership check to iterators1.rs#2377

Open
penguinawesome1 wants to merge 1 commit intorust-lang:mainfrom
penguinawesome1:improve-iterators1-feedback
Open

Add explicit ownership check to iterators1.rs#2377
penguinawesome1 wants to merge 1 commit intorust-lang:mainfrom
penguinawesome1:improve-iterators1-feedback

Conversation

@penguinawesome1
Copy link
Copy Markdown

@penguinawesome1 penguinawesome1 commented Apr 1, 2026

Closes #2261

This PR adds an explicit check to the array after iterator creation to ensure it was not consumed.
I noticed that while that assert technically passes using into_iter() because &str implements Copy, adding this len() check reinforces the intent.

@penguinawesome1 penguinawesome1 changed the title Add ownership check to iterators1.rs to prevent implicit move Add explicit ownership check to iterators1.rs Apr 1, 2026
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.

Using to_iter instead of iter leads to unhelpful errors in iterators1

1 participant