-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Description
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 } ) ; (
^~~~~~~~~~~~~~~~~~~~~~~~~
Metadata
Metadata
Assignees
Labels
No labels