Now I know why the decision was taken to avoid step_by(0)
. I am just clarifying some misunderstandings:
- I didn't want
step_by
to behave just likerepeat
. I wanted it to accept0
as an argument. Currently it accepts numeric iterators, and I would like it to stay that way. - Also, I understand that the
capacity overflow
issue is fromVec
, I only wanted improved static analysis if possible. Since you mentioned the short circuits I got inspired to create this thread: Applyingtake()
on an infinite iterator should make it exactsizediterator - language design - Rust Internals (rust-lang.org). Once this is finalized, the static analysis on the iterators can be improved further.
Maybe you can comment on this bug report I opened regarding the error message issue: Confusing error message on using step_by
and take
on infinite iterator · Issue #123637 · rust-lang/rust (github.com)