Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[stdlib] Added empty iterator#6603

Closed
gsmyridis wants to merge 7 commits into
modular:mainfrom
gsmyridis:smy/iter-empty
Closed

[stdlib] Added empty iterator#6603
gsmyridis wants to merge 7 commits into
modular:mainfrom
gsmyridis:smy/iter-empty

Conversation

@gsmyridis

@gsmyridis gsmyridis commented May 24, 2026

Copy link
Copy Markdown
Contributor

Linked issue

Partly addresses #6589

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • Performance improvement (includes benchmark results below)
  • Documentation update
  • New feature or public API (requires prior proposal or issue approval)
  • Refactor / internal cleanup (no user-visible change)
  • Build, CI, or tooling change

Motivation

Discussed in #6589.

What changed

Added an empty iterator, that yields nothing.

from std.testing import assert_raises
from std.iter import empty

var it = empty[Int]()
with assert_raises():
    _ = next(it)

Testing

Added new tests and successfully ran the whole test suite.

Checklist

  • The linked issue above has been reviewed by a maintainer and is
    agreed-upon, or this is a trivial fix that does not need prior
    approval
  • PR is small and focused — I've split larger changes into a sequence of
    smaller PRs where possible (see
    pull request sizes)
  • I ran ./bazelw run format to format my changes
  • I added or updated tests to cover my changes
  • If AI tools assisted with this contribution, I have included an
    Assisted-by: trailer in my commit message or this PR description (see
    AI Tool Use Policy)

@gsmyridis gsmyridis requested a review from a team as a code owner May 24, 2026 14:27
@github-actions github-actions Bot added mojo-stdlib Tag for issues related to standard library waiting-on-review labels May 24, 2026
@gsmyridis

Copy link
Copy Markdown
Contributor Author

Is the location of the additions correct?

@gsmyridis gsmyridis changed the title Added empty iterator [stdlib] Added empty iterator May 24, 2026
@gsmyridis gsmyridis mentioned this pull request May 24, 2026
11 tasks
@gsmyridis gsmyridis changed the title [stdlib] Added empty iterator [stdlib] Added empty iterator May 24, 2026
Comment thread mojo/stdlib/std/iter/__init__.mojo Outdated
Comment thread mojo/stdlib/std/iter/__init__.mojo Outdated
Comment thread mojo/stdlib/test/iter/test_empty.mojo Outdated
@NathanSWard

Copy link
Copy Markdown
Contributor

Thanks for this @gsmyridis - left a round of feedback, but after the comments get addressed, this PR looks good to go :)

@NathanSWard NathanSWard added waiting for response Needs action/response from contributor before a PR can proceed and removed waiting-on-review labels May 26, 2026
@gsmyridis

Copy link
Copy Markdown
Contributor Author

Thanks for this @gsmyridis - left a round of feedback, but after the comments get addressed, this PR looks good to go :)

Thanks again @NathanSWard for the feedback.

@NathanSWard NathanSWard left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks great, thank you!

@NathanSWard

Copy link
Copy Markdown
Contributor

!sync

@modularbot modularbot added the imported-internally Signals that a given pull request has been imported internally. label May 27, 2026
@modularbot

Copy link
Copy Markdown
Collaborator

✅🟣 This contribution has been merged 🟣✅

Your pull request has been merged to the internal upstream Mojo sources. It will be reflected here in the Mojo repository on the main branch during the next Mojo nightly release, typically within the next 24-48 hours.

We use Copybara to merge external contributions, click here to learn more.

@modularbot modularbot added merged-internally Indicates that this pull request has been merged internally merged-externally Merged externally in public mojo repo labels May 27, 2026
@modularbot

Copy link
Copy Markdown
Collaborator

Landed in 98ff260! Thank you for your contribution 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

imported-internally Signals that a given pull request has been imported internally. merged-externally Merged externally in public mojo repo merged-internally Indicates that this pull request has been merged internally mojo-stdlib Tag for issues related to standard library waiting for response Needs action/response from contributor before a PR can proceed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants