Uh oh!
There was an error while loading. Please reload this page.
RangeFrom should have an infinite size_hint - #42315
Conversation
This makes the size_hint from things like `take` more precise.
rust-highfive
commented
May 30, 2017
(rust_highfive has picked a reviewer for you, use r? to override) |
ollie27
commented
May 30, 2017
I'm not sure we can say |
scottmcm
commented
May 30, 2017
let it = (-5..5).map(|x| 100 / x);assert_eq!(it.size_hint(),(10,Some(10)));Even though iterating it will panic with "attempt to divide by zero" before returning 10 items. A lower-bound of |
alexcrichton
commented
May 30, 2017
bors
commented
May 30, 2017
📌 Commit 265dce6 has been approved by |
| /// | ||
| /// ``` | ||
| /// // an infinite iterator has no upper bound | ||
| /// // and the maximum possible lower bound |
There was a problem hiding this comment.
Infinite iterators can have any lower bound so I don't think this line should have been added.
ollie27
commented
May 31, 2017
Well I guess if |
Mark-Simulacrum
commented
May 31, 2017
@bors rollup |
…crichton RangeFrom should have an infinite size_hint Before, ```rust (0..).take(4).size_hint() == (0, Some(4)) ``` With this change, ```rust (0..).take(4).size_hint() == (4, Some(4)) ```
Before,
With this change,