Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement IntoIterator for fixed size arrays #29455

Closed
nrc opened this issue Oct 29, 2015 · 5 comments
Closed

Implement IntoIterator for fixed size arrays #29455

nrc opened this issue Oct 29, 2015 · 5 comments

Comments

@nrc
Copy link
Member

nrc commented Oct 29, 2015

Size 0 to 12 or whatever.

Because otherwise it is only implemented via autoref and then you get references to the contents where you want the contents by value.

@nrc nrc added the A-libs label Oct 29, 2015
@nrc nrc changed the title Implement IntoIter for fixed size arrays Implement IntoIter for fixed size arrays Oct 29, 2015
@Gankra
Copy link
Contributor

Gankra commented Oct 29, 2015

psuedo-blocked on ManuallyDrop rust-lang/rfcs#197

There's no way to soundly partially move out of an array in a zero-cost way today. @bluss' ArrayVec crate accomplishes this by putting the array in a modified Option (one that supresses the null ptr optimization) and ptr::writeing None in the dtor.

@Gankra
Copy link
Contributor

Gankra commented Oct 29, 2015

We can certainly do the ArrayVec thing to get the job done if it's dire.

@bluss
Copy link
Member

bluss commented Oct 29, 2015

This would be a breaking change since [1, 2, 3].into_iter() compiles in Rust 1.4 (and is the same as calling .iter()). However it's a minor change by being avoidable with more specific/UFCS method calls.

Fortunately for _ in [1, 2, 3] does not compile in Rust 1.4.

@Gankra
Copy link
Contributor

Gankra commented Oct 29, 2015

Seems like acceptable breakage, since this is clearly desirable.

@bluss bluss changed the title Implement IntoIter for fixed size arrays Implement IntoIterator for fixed size arrays Oct 29, 2015
@steveklabnik
Copy link
Member

This is a duplicate of #25725

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants