Skip to content

Conversation

clarfonthey
Copy link
Contributor

Fixes #41691.

This optimisation has been applied manually on a lot of different iterators, including some in the standard library, but it makes more sense to do it automatically with specialisation.

@rust-highfive
Copy link
Contributor

r? @BurntSushi

(rust_highfive has picked a reviewer for you, use r? to override)

@ollie27
Copy link
Member

ollie27 commented Jun 10, 2017

This is a breaking change for iterators with side effects.

@clarfonthey
Copy link
Contributor Author

clarfonthey commented Jun 10, 2017

@ollie27 what exactly do you mean? iterators like Drain and the like will still drop their contents as expected

(we can still do a crater run and check this first)

@ollie27
Copy link
Member

ollie27 commented Jun 10, 2017

Things like (0..10).map(|x| { println!("{}", x); x }).last() would change behaviour.

@nagisa
Copy link
Member

nagisa commented Jun 10, 2017

Yeah, we cannot land this. Similar specialisations have been proposed multiple times already and have been rejected.

I have a similar specialisation for specifically ranges in my Range PR.

I’ll close because there’s no way this will be approved.

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

Successfully merging this pull request may close these issues.

5 participants