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

core::ops::Range is Copyable but not Cloneable #21431

Closed
alexchandel opened this issue Jan 20, 2015 · 1 comment
Closed

core::ops::Range is Copyable but not Cloneable #21431

alexchandel opened this issue Jan 20, 2015 · 1 comment

Comments

@alexchandel
Copy link

Range is an iterator, copyable when its index is copyable, but not cloneable even if its index is both copyable and cloneable. This interferes with traits like itertools::Product, which require cloneable iterators.

Specifically, this prevents one from doing something like:

iproduct!(0us..10, 0us..10).map(|x, y| x*y).all(|z| z >= 0)

which fails with the expected error:

<itertools macros>:2:12: 2:37 error: the trait `core::clone::Clone` is not implemented for the type `core::ops::Range<usize>`
<itertools macros>:2 { let it = $ crate :: Product :: new ( $ I , $ J ) ; it } ) ; (
                                ^~~~~~~~~~~~~~~~~~~~~~~~~
@csouth3
Copy link
Contributor

csouth3 commented Jan 20, 2015

This is a dupe of #21384, and is fixed in #21386.
Thanks for reporting!

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

2 participants