modular / modular/modular

[Feature Request] [mojo-lang] [stdlib] Compile time iteration for `IterableOwned` types.

Open
#6,486 0 comments 0 reactions 1 assignee View on GitHub

@dgurchenkov is already working on this.

Since May 3, 2026.

bug_feature_triaged enhancement mojo
Dominant language
Mojo
Stars
29.8k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

Review Mojo's priorities
What is your request?
def main() raises:
    comptime owned_iter = iter([1, 2, 3])
    comptime for elem in owned_iter:
        print(elem)

output

error: 'paramfor_has_next' parameter 'IteratorType' has 'Iterator & Copyable' type, but value has type 'AnyStruct[_ListIterOwned[Int]]'
    comptime for elem in owned_iter:
                         ^~~~~~~~~~
What is your motivation for this change?

This makes owned iteration at compile time impossible

Any other details?

...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.