Skip to content

Tracking Issue for const_intoiterator_identity #90603

@mbartlett21

Description

@mbartlett21
Contributor

Feature gate: #![feature(const_intoiterator_identity)]

This is a tracking issue for the const IntoIterator implementation for types that are already iterators.

This is not a new api; only constifying an existing one

Public API

// core::iter
// actually core/iter/traits/collect.rs, but re-exported from there.
impl<I: ~const Iterator> const IntoIterator for I {
    type Item = I::Item;
    type IntoIter = I;
    fn into_iter(self) -> I;
}

Steps / History

  • Final comment period (FCP)
    Stabilization PR

Unresolved Questions

  • Should it bound on the resultant Iterator being a const Iterator or not? I've gone with having the bound for now. Note: This can be relaxed later without breaking any code.

Activity

added
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.
on Nov 5, 2021
added a commit that references this issue on Apr 23, 2022
zakarumych

zakarumych commented on Aug 8, 2022

@zakarumych
Contributor

Why would it have I: ~const Iterator bound instead of I: Iterator?

mbartlett21

mbartlett21 commented on Aug 8, 2022

@mbartlett21
ContributorAuthor

See #90602 (comment).
Basically, it makes it compatible with whether the IntoIterator trait gets a bound or not, and if it doesn't get a bound, this implementation can always be loosened later.

zakarumych

zakarumych commented on Aug 9, 2022

@zakarumych
Contributor

Not sure I follow.
It's conservative and can be relaxed later - I get this part.
What is motivation to not relax it right away?

mbartlett21

mbartlett21 commented on Aug 9, 2022

@mbartlett21
ContributorAuthor

It was a decision that could be changed later, so I just chose a choice and went with that. Either way, that's a question that can come up when the actual trait gets changed (or not) and const impls are stabilised.

The motivation is that there was also no motivation to go the other way either.

shahn

shahn commented on Dec 26, 2024

@shahn
Contributor

I noticed that since a0215d8, there is is no remaining usage of const_intoiterator_identity. Should this issue be closed? CC @RalfJung

RalfJung

RalfJung commented on Dec 26, 2024

@RalfJung
Member

Yeah this feature was long removed, I just cleaned up some leftovers in that PR.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @shahn@RalfJung@zakarumych@mbartlett21

        Issue actions

          Tracking Issue for `const_intoiterator_identity` · Issue #90603 · rust-lang/rust