[Feature Request] [mojo-lang] [stdlib] Compile time iteration for `IterableOwned` types.
Open
@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
- I have read the roadmap and priorities and I believe this request falls within the 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.