Skip to content

Conversation

@fee1-dead
Copy link
Member

@fee1-dead fee1-dead commented Jan 18, 2026

Like its predecessors (#92433, #102225, #106541), this PR allows one to make Iterator implementations const, and thus enables the ability to have for loops in const contexts. I've also included constifying Option as IntoIterator, option::IntoIter as Iterator as a minimal dogfooding example.

But unlike its predecessors, it uses a new attribute (not unsound anymore!) that prevents any Iterator extension methods from being called. This is intentionally made minimal for an initial approval, the fun stuff like .fold, Range as Iterator could be done later.

cc @rust-lang/wg-const-eval, cc @oli-obk to review the compiler parts

cc #92476

@rustbot
Copy link
Collaborator

rustbot commented Jan 18, 2026

Some changes occurred in compiler/rustc_hir/src/attrs

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 18, 2026
@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Jan 18, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 18, 2026

r? @scottmcm

rustbot has assigned @scottmcm.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants